How do I include freehand comments in a batch file without using REM statements?

John Savill

January 8, 2000

1 Min Read
ITPro Today logo in a gray background | ITPro Today

[Editor’s Note: Some or all of the following FAQ text was submitted by readers, Royce Williams and Noel Casey.]

A. When Windows NT batch file processing encounters the goto command, the process ignores lines in the batch file until it finds the appropriate goto label.


@echo off
goto Begin

BATCHFILE.BAT v1.01 - does what batch files do
written 09/09/1999 by Joe Programmer

MODIFICATION HISTORY:

v1.00 09/04/1999 jp
initial version

v1.02 09/09/1999 jp
converted all dates in comments to
four-digit years for Y2K compliance

:Begin
<...>

:End

Another method, which works on Windows NT 4.0 and Windows 95, is to use a double colon, as follows.

@echo off
echo Hello
echo.
:: This is equivalent to rem at the beginning of a line
rem This is an equivalent statement to the line above
:: This looks and reads better than rem
:: That’s all
echo Bye!

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like