Suport for spaces in WSH
Hi
I have a script which gets the source path where an exe resides, and then runs that install with some parameters. This is part of that code:
Set WSHShell = CreateObject("WScript.Shell")
sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
WSHShell.run sCurPath & "\AcrobatUpd825_all_incr.msp /passive /norestart" ,1 ,TRUE
This code works fine if the source path retrieved by GetAbsolutePathName(".") has no spaces in it, but if there are spaces the script fails.
I tried adding quotes with this: WSHShell.run Chr(34) & sCurPath & "\AcrobatUpd825_all_incr.msp /passive /norestart" & Chr(34),1 ,TRUE
but the script errors 'The system cant find the file specified."
I also tried: WSHShell.run Chr(34) & sCurPath & Chr(34) & "\AcrobatUpd825_all_incr.msp /passive /norestart",1 ,TRUE
with similar results.
Can anyone shed some light on this for me? Much appreiciated..
I have a script which gets the source path where an exe resides, and then runs that install with some parameters. This is part of that code:
Set WSHShell = CreateObject("WScript.Shell")
sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
WSHShell.run sCurPath & "\AcrobatUpd825_all_incr.msp /passive /norestart" ,1 ,TRUE
This code works fine if the source path retrieved by GetAbsolutePathName(".") has no spaces in it, but if there are spaces the script fails.
I tried adding quotes with this: WSHShell.run Chr(34) & sCurPath & "\AcrobatUpd825_all_incr.msp /passive /norestart" & Chr(34),1 ,TRUE
but the script errors 'The system cant find the file specified."
I also tried: WSHShell.run Chr(34) & sCurPath & Chr(34) & "\AcrobatUpd825_all_incr.msp /passive /norestart",1 ,TRUE
with similar results.
Can anyone shed some light on this for me? Much appreiciated..
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
murali.bhat
14 years ago
![](/build/static/general/appdeploy_logo.png)
so that the conversation will remain readable.