Rem / :: / ; |
Records comments (remarks) in batch files and Config.sys. These are ignored during the execution of the program.
Syntax:REM [comment] In Config.sys only:
In batch files (including Autoexec.bat) only:
Notes:
LimitationsWhen parsing a batch file, Command.com does not simply skip any lines beginning with "REM". Instead, it seems to parse the line for recognized commands/files/whatever and then take no action if the line begins with REM. This is not particularly efficient and a large number of REM statements in a batch file can noticeably slow down its execution.A much more serious problem with REM occurs if the line contains a pipe (|) or redirection (<, >, >>) symbol: everything up to the symbol is ignored BUT the symbol itself and everything following is interpreted as a command line entry - but without the safeguard of syntax checking. This can lead to all sorts of problems - especially when REM is used to temporarily inactivate lines in a batch file. A simple illustration of this can be given by the following: In a batch file the line:
Note that having the line:
The way to avoid such problems is to use the double colon (::) rather than REM. Incidentally, entering either REM echo. | date or :: echo. | date directly on the command line (rather than in a batch file) not only causes Command.com to hang, but the only way to close the Window is with Ctrl-Alt-Del. Not that it makes much sense to enter such a command in the first place. TricksThe REM command is widely used to temporarily disable commands in Config.sys and batch files (but better to use :: or ; - see "Limitations" above). Example:To include an explanatory comment in Config.sys before the COUNTRY command:
or (if you must!):
File Details:Internal |
|