vbscript printing to command line
December 26, 2007 11:55 AM
Subscribe
How does one make a VBScript print to the command line without invoking Cscript before the script.vbs?
Typically, one prints in VBscript using a Wscript.echo("Hello, world!") line or some variant thereof. If you do not invoke with a cscript hello-world.vbs, you get a GUI/pop-up MsgBox, which I wish to avoid. I just want something to go right to the command line for output, without putting cscript at the beginning.
Wscript.StdOut.WriteLine dies, of course, if not also invoked with a Cscript.
I do not want to permanently set my default scripting host to Cscript, either. This isn't "my" environment, so I wish to tread lightly.
posted by adipocere to computers & internet (9 comments total)
The difference is only in the output — WScript generates windowed output, while CScript sends its output to the command window in which it was started.
In short, console output requires cscript. Maybe there's a workaround if you tell us why you want console output.
posted by Horselover Fat at 12:16 PM on December 26, 2007