CANCEL — Stop all command scripts

Synopsis

CANCEL [/?] [value]

Options

/?
Display command syntax information.

Description

The CANCEL command is only valid within command scripts. It cancels the execution of all command scripts, however deeply nested. The result of the CANCEL command is the value specified as its argument. If no argument is given to CANCEL, its result will be zero.

Tip: To return the value of the last command executed as the result of the CANCEL command, use the _ERRORLEVEL implicit environment variable:

[c:\]cancel %_ERRORLEVEL%

Since variable expansion occurs before commands are executed, the CANCEL command should not be combined with other commands onto a single command line in this case, since otherwise _ERRORLEVEL might not have the same value at the point of variable expansion as it has by the time that the CANCEL command is executed.

CALL EXTPROC FOR GOTO GOSUB IF RETURN QUIT EXIT


The 32-bit Command Interpreter is © Copyright Jonathan de Boyne Pollard. "Moral" rights are asserted.