GoTo

Index

Directs Windows to a labelled line in a batch program.

Syntax:

GOTO label
labelThe line in a batch file to which execution should branch.
label must match a label in the batch program or the batch program stops and an error message is displayed.

Notes:

A batch file label is a text string, on a line of its own and beginning with a colon.

The GOTO command uses only the first eight characters of a label. Therefore, the labels "hithere01" and "hithere02" are both equivalent to "hithere0".

Example:

To format a disk in drive A and display an appropriate message of success or failure:

@ ECHO off
FORMAT a: /s
IF NOT errorlevel 1 GOTO end
ECHO An error occurred during formatting.
:end
ECHO Successfully formatted the disk in drive A.

File Details:

Internal


If you should have any comments or suggestions,
please contact: Bob Watson
.
This page last revised:
December 9, 1999.