Purpose:Terminate batch file processing


Format:CANCEL [value]


valueThe numeric exit code to return to TCC.


See also: CALL and QUIT.




The CANCEL command ends all batch file processing, regardless of the batch file nesting level. Use QUIT to end a nested batch file and return to the previous batch file.


You can CANCEL at any point in a batch file. If CANCEL is used from within an alias it will end execution of both the alias and any batch files which are running at the time.


The following batch file fragment compares an input line to "end" and terminates all batch file processing if it matches:


input Enter your choice:  %%option

if "%option" == "end" cancel


If you specify a value, CANCEL will set the ERRORLEVEL or exit code to that value (see the IF command, and the %? variable).