JSI Tip 7575. How can I cause a batch script to return a specific ERRORLEVEL to the script or program that started it?

The Exit command will set an ExitCode into the ERRORLEVEL.

The syntax is:

exit \[/b\] \[ExitCode\]

where the /b exits the current batch script, as apposed to CMD.exe, the command interpreter, and ExitCode is a numeric value used to set the ERRORLEVEL.



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish