RETURN
[/?]
[value]
/?The RETURN command is only valid within command scripts and when executing a subroutine called by GOSUB. It returns from the subroutine and causes the GOSUB command that called it to complete and proceed to the next command. The result of the RETURN command is the value specified as its argument. If no argument is given to RETURN, its result will be zero.
Tip: To return the value of the last command executed as the result of the RETURN command, use the _ERRORLEVEL implicit environment variable:
[c:\]return %_ERRORLEVEL%
Since variable expansion occurs before commands are executed, the RETURN 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 RETURN command is executed.
CALL EXTPROC FOR GOTO GOSUB IF> CANCEL QUIT EXIT