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   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


You need to add Chr(34) to the path of the file which you are running. Pass the parameter in the quotes.

WSHShell.run Chr(34) & sCurPath & "\AcrobatUpd825_all_incr.msp" & Chr(34) & " /passive /norestart",1 ,TRUE
Answered 01/05/2011 by: murali.bhat
Purple Belt

Please log in to comment
Thanks Murali

That worked nicely!
Answered 01/06/2011 by: krpa
Senior Yellow Belt

Please log in to comment