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 OFF is set at the beginning of the script, lines starting with REM will print to the screen during execution. Prepending the line with an at-symbol (@REM) silences that individual line even if ECHO is on.
  • Redirection and Piping Quirks: Because COMMAND.COM treats REM as a command, it parses the line before ignoring the text. This means using redirection characters (such as >, <, or |) inside a REM statement can cause unexpected behavior. For example, REM Output to file > test.txt will still create or overwrite test.txt with zero bytes.
  • Performance and Alternatives: Each REM line requires COMMAND.COM to 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 that COMMAND.COM ignores faster than a REM command 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 REM before directives such as DEVICE=, DEVICEHIGH=, or BUFFERS= bypasses that instruction entirely. This is commonly used for troubleshooting hardware drivers or memory managers like HIMEM.SYS and EMM386.EXE.
  • No Redirection Hazards: Because CONFIG.SYS is 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 a REM line.
  • The Semicolon Alternative: MS-DOS 6.0 and 6.22 introduced the semicolon (;) as an alternative comment character specifically for CONFIG.SYS. A semicolon placed at the very beginning of a line acts identically to REM, 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.