I inherited some code as part of a Rube Goldbergian file-to-db process, and it has a step that uses JavaScript on Windows to parse csv files. Instructions said to use WScript to run it [sic]. Boy, that was fun. When I decided to push all the debugging into a central function that also output the info to WScript.Echo, each call to Echo would be output to a message box, which is insanely annoying.

Quick SO answer to the rescue. Quick sum: Run the script with cscript and everything goes to the console instead. That is, WScript assumes running in a Windows app context, and cscript assumes a console.

Side note: You can't use CScript.Echo in place of WScript.Echo, however. WScript is used regardless of the context you use to run the script. So don't try and get clever, kk?

Labels: , ,