Name

rem — Internal to: \Windows\command.com

Synopsis

Insert comments (“remarks”) into a batch file. Lines beginning with rem will be ignored when the batch file is executed.

Syntax

rem [comment]

Description

The comment can say whatever you want. It’s a good idea to put comments in your batch file so that others (including you in the distant future) can figure out how it works.

The rem command is also useful for disabling commands. Just add rem right before the command to disable it.

Examples

A batch file that uses remarks for explanations and to disable a command:

@echo off
rem This batch program may one day change a directory.
rem But not until I remove the rem before the cd command.
rem It is called mydir.bat.
rem cd \batch\ch2

This example, if executed, would do absolutely nothing.

See Also

“echo”

Get Windows XP in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.