VBS with Space in File Path

Solution 1:

You need to quote the file specification:

Run("%comspec% /K ""C:\Program Files\ping.bat""")

Solution 2:

I had a similar problem with a directory path in a VBScript that had empty spaces:

E.g.

The following did not work:

objShell.Run("C:\Program Files\NetBeans 8.0.2\bin\netbeans64.exe") 

I simply included two extra double quotations on either side of the path and it worked for me:

objShell.Run("""C:\Program Files\NetBeans 8.0.2\bin\netbeans64.exe""")