Philip.ie
Philip.ie

Reputation: 1496

How do I return an exit code from a VBScript console application

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?

Upvotes: 45

Views: 93921

Answers (2)

Philip.ie
Philip.ie

Reputation: 1496

I found the answer :0)

 DIM returnValue
 returnValue = 99
 WScript.Quit(returnValue)

This seems to work well.

Upvotes: 36

Rob
Rob

Reputation: 45780

Try:

WScript.Quit n

Where n is the ERRORLEVEL you want to return

Upvotes: 64

Related Questions