WshShell.Run """C:\Program Files\Target.exe"" -s"
In command above, I want to use a string instead of the path, but it is not working!
Directory = "C:\Program Files\Target.exe"
WshShell.Run """Directory"" -s"
How to do it?
WshShell.Run """C:\Program Files\Target.exe"" -s"
In command above, I want to use a string instead of the path, but it is not working!
Directory = "C:\Program Files\Target.exe"
WshShell.Run """Directory"" -s"
How to do it?
Using Chr(34)
might make things clearer.
Directory = "C:\Program Files\Target.exe"
WshShell.Run Chr(34) & Directory & Chr(34) & " -s"
Otherwise, the syntax you're looking for gets a bit complicated:
WshShell.Run """" & Directory & """ -s"
If you need to use a quote character within a string literal, it must be doubled.
And if you need to include a VBScript variable, it should be concatenated (&
).