I Have an old vbs script file being kicked off by an AutoSys job. Can I, and how do I, return an int return value to indicate success or failure?
A Exit For Statement is used when we want to Exit the For Loop based on certain criteria. When Exit For is executed, the control jumps to next statement immediately after the For Loop.
By checking the properties of the Err object after a particular piece of code has executed, you can determine whether an error has occurred and, if so, which one. You can then decide what to do about the error —you can, for instance, continue execution regardless of the error, or you can halt execution of the program.
Try:
WScript.Quit n
Where n is the ERRORLEVEL you want to return
I found the answer :0)
DIM returnValue
returnValue = 99
WScript.Quit(returnValue)
This seems to work well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With