Accelerating batch files

The 'REM' command

COMMAND.COM reads and executes batch files one line at a time; that means that it reads one line, execute it and rereads the file from the beginning to the next line. If you do not have a good disk-cache installed, it is not efficient.

When using REM in your batch files to insert a remark, COMMAND.COM reads the comment line, execute it (i.e., does nothing) and rereads the file from the beginning to the next line.

Furthermore, if you put the REM command on the begin of a line containing a redirection

ex: rem echo something > file.dat

it will not execute the command after the REM, but will redirect nothing to the fileoutput .

To avoid this, there is a trick: use '::' instead of 'REM'. ':' is understood as a label to be used by the 'GOTO' statement (see your DOS documentation); this line will never be executed. As a label cannot begin with a ':', this line will not be considered as an executable line, nor as a label.

ex: replace REM This batch file uses characters like >,...
by :: This batch file uses characters like >,...