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 signa
%errorlevel%
You might use the technique described in this article. It requires you to wrap your script inside a VBScript class.