WScript.Quit

Exit the VBScript script.

Syntax 
      WScript.Quit [intErrorCode]

Arguments:
   intErrorCode  An exit (or error) code

The default is to return no value (0)

Example

WScript.Quit 1

If calling a VBScript from a batch file, catch the Errorlevel with an IF statement

cscript.exe MyScript.vbs
IF errorlevel 1 goto s_next

“You might as well aim high. Why shoot yourself in the foot when you can shoot yourself in the head?” - William Shatner

Related

Equivalent Windows CMD command: EXIT - Quit the CMD shell
Equivalent Powershell command: Exit


© Copyright SS64.com 1999-2013
Some rights reserved