Directs Windows NT to a line in a batch program marked by a label you specify.
The goto command directs Windows NT within a batch program to a line identified by a label. When Windows NT finds the label, it processes the commands beginning on the next line.
Specifies the line in a batch program to which Windows NT should go.
The label parameter can include spaces but cannot include other separators, such as semicolons or equal signs.
The goto command uses only the first eight characters of a label. Therefore, the labels ":hithere01" and ":hithere02" are both equivalent to ":hithere0".
The label value you specify on the goto command line must match a label in the batch program. The label within the batch program must begin with a colon.
If your batch program does not contain the label that you specify, the batch program stops and Windows NT displays the following message:
Label not found
Windows NT recognizes a batch-program line beginning with a colon (:) as a label and does not process it as a command. If a line begins with a colon, Windows NT ignores any commands on that line.
Goto is often used on the same command line with other commands to perform conditional operations. For more information about using goto for conditional operations, see the if command.
The following batch program formats a disk in drive A as a system disk. If the operation is successful, the goto command directs Windows NT to a label named "end".
echo off format a: /s if not errorlevel 1 goto end echo An error occurred during formatting. :end echo End of batch program.