Table of contents:

File names an file extensions

Windows relies on the use of file extensions to decide what to do with a file. Typically your system will recognize .bat and .cmd as files to be processed by the command shell (cmd.exe). You can use ftype and assoc commands to add other file extensions.


REM testlable1.cmd
REM This is a comment
:: This is a comment as well

The double colon is not documented, but it serves the same purpose and is interchangeable with REM.


Labels are single words that start with a colon. They can be or subroutine identifiers or the target of a GOTO

GOTO MyLabel

REM control passes to this spot

REM testlable2.cmd
CALL MyLabel some_parameter
echo Control has passed back
goto :EOF

REM control passes to this spot
echo You passed this parameter: %1
goto :EOF


You passed this parameter: some_parameter
Control has passed back

:EOF is a special label that refers to the end of the file. You do not have to explicitly define this label. This is nice if you really want to jump to the end of the file. When you use a subroutine, control will return to the calling statement only after the subroutine reaches the :EOF.

Created by system. Last Modification: Monday 12 of May, 2008 22:24:51 EDT by gmartin.