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

\[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<br>
goto Begin<br><br>
BATCHFILE.BAT v1.01 - does what batch files do<br>
written 09/09/1999 by Joe Programmer<br><br>
v1.00 09/04/1999 jp<br>
initial version<br><br>
v1.02 09/09/1999 jp<br>
converted all dates in comments to<br>
four-digit years for Y2K compliance<br><br>

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

@echo off<br>
echo Hello<br>
:: This is equivalent to rem at the beginning of a line<br>
rem This is an equivalent statement to the line above<br>
:: This looks and reads better than rem<br>
:: That&#8217;s all<br>
echo Bye!
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.