- 1 year ago
windows bat file cannot comment out this
Comment
1 / 1
In Windows batch files, you can comment out lines using the REM
command. Here's an example:
batchREM This is a comment
echo Hello, world!
REM This line is commented out
In the example above, the line beginning with REM
is treated as a comment and is ignored when the batch file is executed.
If you want to comment out multiple lines at once, you can use the REM
command before each line or use a block comment workaround:
batch:: This is a comment
echo Hello, world!
:: This line is commented out
In this case, the double colons (::
) act as a block comment, and all the lines between them are ignored.
Note that in Windows batch files, there is no dedicated syntax for multi-line comments. You need to add REM
or ::
at the beginning of each line to comment it out individually or use the block comment workaround for multiple lines.