I have a batch file that calls a VBScript (.vbs) program. After calling it, my batch script checks %errorlevel%
to see if the .vbs program failed. I can signal failure with an exit code in the .vbs program with WScript.Quit(1)
.
However, I can only do that explicitly. If some unexpected run-time error happens, the .vbs quits with an error dialog box, however the exit code is zero so my batch file thinks it suceeded! How can I change that behavior?
And if you are thinking of saying, use on error goto
, don't bother... that syntax is available in regular VB, but not in VBScript.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…