r
GOTO
r-
GOTO label
Chapter 6 / Command Reference
Internal
A
batch
file command
that
transfers control to
the
line (in
the
I
batch
file) following
the
one specified
by
label.
I
:-
I
I
r
I
l .
~
i
I
r
!
Parameters
label is a character string. MS-DOS considers only
the
first 8
characters;
it
ignores
the
rest. When a batch file executes, the
screen does not display its labels. Therefore, you can use labels
to include comments
in
a batch file.
Notes
and
Suggestions
• Use GOTO
with
the
IF
command to direct execution to partic-
ular
subroutines when
particular
conditions exist. (See
the
IF
command.)
• Using GOTO and IF, you can create a batch file
that
copies a
specified source file to a specified
target
file only
if
the
target
does not already exist.
If
the
target
exists,
the
file pauses
so
you
can
halt
the
copy.
Examples
copy
can
chekdest.bat
[ENTERI
rem
When
executing,
substltute
the
drive
for
%1
and
the
d
ire
et
a r y
for
%2 I
ENTER
I
rem
When
executing,
substitute
the
source
file
for
%
3,
the
tar
get
for
%4 I
ENTER
I
%1 I
ENTER
I
c h d
lr
%2 I
ENTER
I
i f
nat
ex
1 s t %4
got
a 9 I
ENTER
I
t YP e i. 4 I
ENTER
I
p a
use
I
ENTER
I
: 9 I
ENTER
I
cap
y
i.3
i.
4 I
ENTER
I
:
end
I
ENTER
I
mJ
[ENTER
I
105