Hopefully "ScriptingTipsAndTricks" helps you with your batch file or vbscript scripting :-)
[Bottom][Contents][Prev]: DIR (Lists file and or directories and their attributes)[Next]: FIND.exe (filters text files by text)
\->Windows Commands->EXIT (quit with specified Return Code)

EXIT (quit with specified Return Code)

If you want to return an "ERRORLEVEL" (return code) to a caller then this command allows you to set it.

SYNTAX: EXIT /?

Quits the CMD.EXE program (command interpreter) or the current batch
script.

EXIT [/B] [exitCode]

  /B          specifies to exit the current batch script instead of
              CMD.EXE.  If executed from outside a batch script, it
              will quit CMD.EXE

  exitCode    specifies a numeric number.  if /B is specified, sets
              ERRORLEVEL that number.  If quitting CMD.EXE, sets the process
              exit code with that number.

The command processor (CMD.EXE) doesn't pick up return codes from an exit with "/B" (idiots, they're everywhere...)! So you should drop the "/B" to exit the command processor instead (of the batch file).


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: DIR (Lists file and or directories and their attributes)[Next]: FIND.exe (filters text files by text)


ScriptingTipsAndTricks© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Sunday September 07 2014 at 12:50pm
Visit ScriptingTipsAndTricks's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.