A batch file (batch script) in Windows is a text file that typically has a
.bat extension and includes one or more command prompt commands.
It is a good practice to comment a source code in a batch file by leaving the remarks that explain functionality of some lines or blocks of code.
Also any line or a block of code in a batch file can be disabled by turning it into a comment (comment out) and enabled back (uncomment).
This note shows how to comment batch files in Windows.
Cool Tip: Get the return code from the last command or application! Read more →
Batch File Comment
A batch file can be commented using either two colons
:: or a
The main difference is that the lines commented out using the
REM command will be displayed during execution of the batch file (can be avoided by setting
@echo off) while the lines commented out using
::, won’t be printed.
Create a comment (remark) or comment a line of code in a batch file:
:: This is a comment that won't be printed - or - REM This is a comment that will be printed
ECHO "Hello" & :: This command prints 'Hello' - or - ECHO "Hello" REM This command prints 'Hello'
A block of code (multiple lines) in a batch file can be commented out using
GOTO comment ...skip this... :comment
Cool Tip: How to respond “Yes” or “No” to prompts in Windows PowerShell & CMD automatically! Read more →
3 Replies to “Batch File Comment (Remark) – Windows”
Perfect. Exactly what I wanted to know. Thanks.
Perfect quick straight forward