2007-12-17

WScript vs. ERRORLEVEL

If you invoke a Windows script directly from a command prompt, it will be launched using WScript and its exit status (set using WScript.Quit) will be gobbled.  If you launch it using CScript, the exit status will be returned properly.  Interestingly, if you invoke a script file from within a batch file, CScript is used automatically, despite the default file association to WScript.