Using REM in MS-DOS 6.22 Batch Files and CONFIG.SYS
The REM (Remark) statement in MS-DOS 6.22 serves as the
primary method for adding non-executable comments and documentation to
both batch files and the CONFIG.SYS configuration file.
While its core purpose across both environments is to instruct the
operating system to ignore the subsequent text on that line, its
operational behavior, performance implications, and parsing mechanisms
differ noticeably between the command interpreter
(COMMAND.COM) and the system initialization process.
REM in MS-DOS 6.22 Batch Scripts
In batch scripts (.BAT), REM is an internal
command executed by COMMAND.COM. Anything typed after
REM on the same line is treated as a comment and is not
executed.
- Echo Behavior: By default, MS-DOS displays commands
on the screen as they run. Unless
@ECHO OFFis set at the beginning of the script, lines starting withREMwill print to the screen during execution. Prepending the line with an at-symbol (@REM) silences that individual line even ifECHOis on. - Redirection and Piping Quirks: Because
COMMAND.COMtreatsREMas a command, it parses the line before ignoring the text. This means using redirection characters (such as>,<, or|) inside aREMstatement can cause unexpected behavior. For example,REM Output to file > test.txtwill still create or overwritetest.txtwith zero bytes. - Performance and Alternatives: Each
REMline requiresCOMMAND.COMto read, parse, and discard the command. In large loops, this can slow execution down. A common alternative among DOS users is using a double colon (::). The double colon acts as an invalid label thatCOMMAND.COMignores faster than aREMcommand and avoids redirection side effects.
REM in CONFIG.SYS
During system boot, IO.SYS parses
CONFIG.SYS before COMMAND.COM is loaded into
memory. In this file, REM serves as a directive to disable
drivers or add configuration notes.
- Driver Disabling: Placing
REMbefore directives such asDEVICE=,DEVICEHIGH=, orBUFFERS=bypasses that instruction entirely. This is commonly used for troubleshooting hardware drivers or memory managers likeHIMEM.SYSandEMM386.EXE. - No Redirection Hazards: Because
CONFIG.SYSis not parsed by a standard command shell, redirection symbols like>or|have no special meaning and will not trigger file system writes or syntax errors when placed on aREMline. - The Semicolon Alternative: MS-DOS 6.0 and 6.22
introduced the semicolon (
;) as an alternative comment character specifically forCONFIG.SYS. A semicolon placed at the very beginning of a line acts identically toREM, providing a cleaner and shorter syntax for remarking out configuration lines. Note that the semicolon does not function as a comment operator in standard batch files.