Programming Field

Rem - DOS/Command Prompt Reference

Does nothing when executed. Used to write comments or etc. in batch files.


rem <any-strings>
<any-strings> Specifies any text without newlines and text starting with ‘/?’. You can also specify nothing (treated like an empty line).


Rem is used to write comments in batch files, and does nothing, regardless of what you specify, except for newlines and text starting with ‘/?’. However, if you specify ‘/?’, the usage of Rem command will be displayed, and if you specify any text after ‘/?’ and space character, an error occurs.

Note that ‘;’ (semicolon) for comment-leading character can only be used in Config.sys and cannot be used in prompts and batch files. On the other hand, ‘:’ (colon) can be used for comment-leading character.


Sample 1 (Batch file)

@rem Version 2012-06-17
@echo off

Adds version information for a comment. In this case, ‘@’ is necessary to suppress the command line since the comment is written before ‘echo off’.

Sample 2 (Batch file)

rem set BLASTER=A220 I5 D1 H5 P330 T6
set BLASTER=A220 I7 D1 H5 P330 T6

If you don't want to use the command you wrote before but want to keep it without deleting it, you can disable and keep it by using ‘rem’.

See also