A simple VBScript containing the single line wscript.quit(2)
, called from a batch script does not pass the quit parameter value into the batch errorlevel variable as it should - the batch file only echos the default error level (0).
I recently uninstalled VB6 (necessary for clean installation of VB.net) and I think this may be, at least, part of the problem. In building a work-around to pass the results of a VBScripting message box to a calling batch file, I found that the scripting file system object (scrrun.dll) had been unregistered by the uninstallation and it was necessary to re-register it to instantiate the object. I'm wondering if there is some other dependency which is required by wscript.exe to give the quit function access to the batch error level variable.
I ran wscript.exe under Dependency Walker for the aforementioned one line VBScript and the only error message I got during the execution was the following:
GetProcAddress(0x755C0000 [MSCTFIME.IME], "ImeGetImeMenuItems") called from "IMM32.DLL" at address 0x76397354 and returned NULL. Error: The specified procedure could not be found (127).
The script terminated with the proper quit code (2).
The dll mentioned exists in the System32 folder with WScript and is unregisterable.
I'm running WinXP with all the latest updates.
Any ideas would be appreciated.