home *** CD-ROM | disk | FTP | other *** search
- ------------------------- GOTO - Batch Subcommand ----------------------------
-
- GOTO alters the sequence in which batch file lines are executed by "transferring
- control" to the line following the specified label.
-
- FORMAT: GOTO label
-
- REMARKS:
-
- A "label" is indicated in a batch file by a ":" followed by the label name.
- GOTO transfers control (the next line to be executed) to the line following
- the specified label. If the label is not found, the batch file terminates
- with the message "Label not found." Only the first eight characters of a
- label are significant, that is, only the first eight characters are used to
- differentiate between similar labels.
-
- EXAMPLE:
-
- In this example, the replaceable parameter, %1, will be set to the name of a
- file. If the file is found on disk, the GOTO Subcommand will transfer control
- to the label :PRINT and the next line to be executed will be PRINT %1. If the
- file does not exist the next line executed will be "REM File %1 not found."
-
- REM Print the File if it exists
- IF EXIST %1 GOTO PRINT
- REM File %1 not found
- PAUSE
- :PRINT
- PRINT %1