First, use cscript.exe and not wscript.exe. Cscript will put the echo output in the text file you specify, while wscript will display a popup box. Second, "//E:VBScript" seems to be optional. I haven't seen any difference when I use this command or when I don't.
Dec 26, 2007 · Any Windows console app, including cscript, will close the console on exit if it wasn't launched from inside a console. If you launched hincandenza's solution from a cmd prompt by typing its name, and wscript was the default script handler, cscript would end up being "insulated" from the original console by the existence of the non-console wscript app that called it. You ran the script using wscript.exe as the host instead of cscript.exe. What you can do: If you may want to run the script using either wscript or cscript as the host executable, change the WScript.StdOut.WriteLine to WScript.Echo. That will give you a popup box when using wscript, and write a line of output to the console when using cscript.