Command Prompt for Windows




Command GOSUB

Function:

Jump to another part of a batch file and continue executing the batch file from that point onwards until a RETURN command is found. Execution of the batch file will then return to the next command following the original GOSUB command.

Syntax:

GOSUB label
labelSequence of characters.

Note:

The label must also appear on its own line elsewhere in the batch file, preceded by a colon, for example :-

GOSUB subproc
...
...
STOP

:subproc
...
...
RETURN

GOSUBs can be nested a maximum of 8 levels.

Also see command GOTO and Batch Files.