|
GOTO
Jump to a section in a batch file. Directs the Windows NT
command interpreter to a labeled line in a batch program.
Syntax
goto label
Parameters
label : Specifies the line in a batch program that you
want to go to.
To go to a different section in a batch file. You may create
different sections by preceding the name with a colon.
:SUBSECTION
Programmers may find this similar to funtions or
sub-routines.
@ECHO OFF
:FIRSTSECTION
ECHO This is the first section
PAUSE
GOTO SUBSECTION
:SUBSECTION
ECHO This is the subsection
PAUSE
Skip sections of a batch file
@ECHO OFF
:ONE
ECHO This is ONE, we'll skip TWO
PAUSE
GOTO THREE
:TWO
ECHO This is not printed
:THREE
ECHO We skipped TWO!
PAUSE
GOTO END
:END
CLS
EXIT
Looping with GOTO
:BEGIN
REM Endless loop, Help!!
GOTO BEGIN
Batch File Commands
|