The EXIT command causes the instance of the command processor that is running the command to exit. The result of the EXIT command is the value specified as its argument. If no argument is given to EXIT, its result will be zero.
Since this is the last command that the command interpreter will execute, the result of the EXIT command will thus be the return value of the command interpreter process.
Tip: To return the value of the last command executed as the result of the EXIT command, use the _ERRORLEVEL implicit environment variable:
Since variable expansion occurs before commands are executed, the EXIT 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 EXIT command is executed.
CALL EXTPROC FOR GOTO GOSUB IF> RETURN CANCEL QUIT