Microsoft DOS goto command
Moves a batch file to a specific label or location, enabling a user to rerun a batch file or skip other lines depending on user inputs or events.
The goto command is an internal command that is available in the below Microsoft operating systems.
Directs Windows to a labeled line in a batch program.
label Specifies a text string used in the batch program as a label.
You type a label on a line by itself, beginning with a colon.
Windows 2000 and Windows XP additional syntax
If Command Extensions are enabled GOTO changes as follows:
GOTO command now accepts a target label of :EOF that transfers control to the end of the current batch script file. This is an easy way to exit a batch script file without defining a label. Type CALL /? for a description of extensions to the CALL command that make this feature useful.
In the below example, the batch file would only print "DONE", skipping anything that is between the GOTO and the GOTO target label.
ECHO SKIPPING THIS
- How can I loop or start a batch file over after it has completed?
- Full listing of batch file examples, help, and support.
- See the goto dictionary definition for additional information and related links on this term.