Purpose:Terminate the current batch file

 

Format:QUIT [value ]

 

valueThe numeric exit code to return to TCC or to the previous batch file.

 

See also: CANCEL and EXIT.

 

Usage:

 

QUIT provides a simple way to exit a batch file before reaching the end of the file. If you QUIT a batch file called from another batch file, you will be returned to the previous file at the line following the original CALL.

 

QUIT only ends the current batch file. To end all batch file processing, use the CANCEL command.

 

If you specify a value, QUIT will set the ERRORLEVEL or exit code to that value. For information on exit codes see the IF command, and the %? variable. Numeric input may be entered in either decimal format (a sequence of 0-9 digits) or in hexadecimal format ("0x" followed by a sequence of 0-F hex digits).

 

You can also use QUIT to terminate an alias. If you QUIT an alias while inside a batch file, QUIT will end both the alias and the batch file and return you to the command prompt or to the calling batch file.

 

Example:

 

This batch file fragment checks to see if the user entered "quit" and exits the batch file if true.

 

input  Enter your choice :  %%option

if  "%option" == "quit"  quit