The command: "REM" is on Windows 12, 11, 10, .. , MS Server 2025, 2022, 2019, .. available
The examples for the command "REM"
The
`REM` (Remark) command in the Windows Command Prompt is used to add comments in batch scripts. Comments are lines in the batch script that are ignored by the computer and are only for human readability. Here are some examples of using the
`REM` command:
Example 1: Simple comment:
REM This is a simple comment.
Description: This line is ignored by the computer. It's just a comment that is useful to the human reading the script.
Example 2: Comment with script information:
@ECHO OFF
REM This script performs a specific task.
REM Author: Your name
REM Date: January 1, 2023
Description: Comments are used here to document information about the script, author and date. The
`@ECHO OFF` command disables the display of commands in the script.
Example 3: Comment next to a command:
ECHO "Hello, world!" REM This outputs the text.
Description: The comment is placed after the
`REM` command and explains what the previous command (
`ECHO`) does.
Example 4: Comment on instructions:
REM steps to run the script:
REM 1. Open Command Prompt.
REM 2. Navigate to the script's directory.
REM 3. Type the command "script.bat" and press Enter.
Description: Comments are used here to provide written instructions for running the script.
The
`REM` statement is flexible and can be used for various types of comments and explanations in batch scripts. It is important to note that anything after
`REM` on a line is considered a comment and will not be executed by the computer.
"REM" Excerpt from Microsoft Windows Help
Microsoft Windows [Version 10.0.19045.3693]
(c) Copyright 1985-2023 Microsoft Corp.
C:\\WINDOWS>
Records comments (remarks) in a batch file or CONFIG.SYS.
REM [comment]
Important information, tips for the "REM" command
There are a few important points to note when using the
`REM` command (Remark) in the Windows Command Prompt:
1.
Ignored by computer: The
`REM` command is ignored by the computer and is only used to add comments in batch scripts. This means that anything after
`REM` on a line is not considered a command to be executed.
2.
Positioning `REM`: The
`REM` command can be placed at the beginning of a line or after an existing command. Anything after
`REM` on a line is treated as a comment.
3.
Space: If the
`REM` command is at the beginning of a line, care should be taken that there is no space before
`REM`. A space at the beginning could cause the
`REM` command to be interpreted as part of a command.
REM Correct:
REM This is a comment.
REM Incorrect:
REM This could be interpreted as a command.
4.
Example Usage: The
`REM` command is particularly useful for documenting batch scripts, adding comments to explain commands, or guiding users.
@ECHO OFF
REM This script performs a specific task.
REM Author: Your name
REM Date: January 1, 2023
ECHO "Hello, world!" REM This prints the text.
5.
Multi-line comments: There is no special syntax for multi-line comments using
`REM`. If you want to add multiple lines as a comment, you need to use
`REM` for each line separately.
REM This is a
REM multi-line comment.
It is important to emphasize that
`REM` is only used for comments within batch scripts and is not considered by the computer as a command to be executed. This makes it a useful tool for documentation and annotations in scripts.