/build/static/layout/Breadcrumb_cap_w.png

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..

0 Comments   [ + ] Show comments

Answers (2)

Posted by: murali.bhat 13 years ago
Purple Belt
0
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
Posted by: krpa 13 years ago
Senior Yellow Belt
0
Thanks Murali

That worked nicely!
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ