::This is a label that acts as a comment
The double-colon ::
comment shown above is not documented as being a comment command, but it is a special case of a label that acts as a comment.
Caution: when labels are used as comments within a bracketed code block or for
command, the command processor expects every label to be followed by at least one command,
so when a jump is made to the label it will have something to execute.
The cmd
shell will try to execute the second line even if it is formatted as a label (and this causes an error):
(
echo This example will fail
:: some comment
)
When working within bracketed code blocks it is definitely safer to use REM for all comment lines.