/build/static/layout/Breadcrumb_cap_w.png

Null the System Cannot Find the Specified File. Help please

Hi All

I have a VB Script as below

Dim WshShell, objFSO
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("C:\Program Files\My App\MyApp.txt") Then WshShell.Run("C:\Program Files\My App\MyApp.exe")

It seems to be Erroring out on Line 4 Chr 85 (the start of the WshShell.Run) I cannot see anything obvious, the path does exist since I can copy and paste it into Start\Run and it will launch.

Anyone got any ideas?

0 Comments   [ + ] Show comments

Answers (1)

Posted by: happyphunn 14 years ago
Senior Yellow Belt
0

Need to have quotes around that path becuase there is a space in it.

See the updated code below.

Dim WshShell, objFSO
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("C:\Program Files\My App\MyApp.txt") Then WshShell.Run("""C:\Program Files\My App\MyApp.exe""")
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