Today, someone asked me about a problem he had running an application from VBScript. Here is the text of my reply:
Adding the parameters to the end of the .exe name should work. Often, however, the problem is spaces / quotes in the command line. The following recipe should deal with all such problems.
Write out the command you want to execute in full, e.g.
C:\Program Files\JavaThingy\Java.exe -silent -otherParameters:”value” -finalParameter
If there is a space in the path to the executable, put this bit in quotes.
“C:\Program Files\JavaThingy\Java.exe” -silent -otherParameters:”value” -finalParameter
Then, double _all_ quotes in the whole line
“”C:\Program Files\JavaThingy\Java.exe”” -silent -otherParameters:””value”” -finalParameter
Put another set of quotes around the whole thing, and add the WshShell.Run gubbins:
WshShell.Run “””C:\Program Files\JavaThingy\Java.exe”” -silent -otherParameters:””value”” -finalParameter”, 1