Command GOTO
Function:
Switch to another part of the batch file, and continue executing the program from that point.
Syntax:
GOTO label
label Sequence of characters.
Note:
The label must also appear on its own line elsewhere in the batch file, preceded by a colon, for example :-
GOTO end
...
...
...
:end
A label can not be placed inside any loops, if they are then a No such label error is displayed and the batch file will stop. Consider the following erroneous example :-
FOR %i IS 1 TO 10 DO {
:label
GETSTR Enter (Y/N)?
if (GETSTR != "y" && GETSTR != "n") GOTO label
}
However, command GOTO can be used to jump out of any loops. For example :-
SET count=0
WHILE (count < 5) {
GETSTR Enter (Y/N)?
if (GETSTR == "y" || GETSTR == "n") GOTO label
LET count=count - 1
}
:label
Also see command GOSUB and Batch Files.
