Used as the target of GOTO command(s).
Most commonly used with GOTO.
The LABEL must begin with, at least, one colon (:).
The first 8 characters of the LABEL should be unique. Otherwise, when the GOTO is executed; it will choose the LABEL to transfer control to (and that could be the "wrong" LABEL, resulting in an infinite loop).
Use of a double colon (::) before a LABEL (::THIS IS A REMARK) is a "fast" batch remark (for some reason, DOS parses any REM command it finds; taking "extra" time).
The infinite loop:
@ECHO OFF :AGAIN ECHO Press CONTROL+BREAK to stop! GOTO AGAIN
The fast (executes faster) remark:
@ECHO OFF ::This is to remind me to backup... ECHO backup!
IF Branch to the appropriate message:
@ECHO OFF FIND /I "error" < my.log IF ERRORLEVEL 2 GOTO LERROR IF ERRORLEVEL 1 GOTO LNOT IF ERRORLEVEL 0 GOTO LFOUND GOTO LEND :LERROR ECHO Houston, the "find" command had a problem! GOTO LEND :LNOT ECHO not found. GOTO LEND :LFOUND ECHO found at least once. GOTO LEND :LEND