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

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.

Answers

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""")
Answered 10/09/2009 by: happyphunn
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity