Execute an exe from VBS with space in file name

Hi All,

I was having problem on executing an exe file from vbs, the problem was the exe path has space between it. For example “C:\Program Files\test\my app.exe”.

The vbs will returns an error which says file not found for that path. This is happened because after the space, the vbs will treat the entire command after the space as arguments.

To fix it we can use multiple quote like this.

wscript.run """C:\Program Files\test\my app.exe"""

Use 3 quote.

What if we want to use arguments in our command?

wscript.run """C:\Program Files\test\my app.exe"" /command args"

Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *