
Re: Problem with a label in parentheses
i thought that too after having the same error and didn't use the comment in the for command until short time, but there is another error happen when you add two comment lines after each other
Ex 1
Quote:
@echo off
for /L %%a in (1 1 5) Do (
:: test comment 1
echo ok
)
pause
This will work fine and display the ok five times,
ButCode:
@echo off
for /L %%a in (1 1 5) Do (
:: test comment 1
:: test comment 2
echo ok
)
pause
Adding another comment after the first will cause this error but will show the ok after each error
Quote:
The system cannot find the drive specified.
ok
The system cannot find the drive specified.
ok
The system cannot find the drive specified.
ok
The system cannot find the drive specified.
ok
The system cannot find the drive specified.
ok
i have no idea why, but when using the REM command instead of :: it work fine
Edit,just tested the code Ed Dyreen posted for multi line comment, it work under the for loop, if some one insist on using the :: to comment on multi lines but the same apply here can't use two sets of them:lol:
Code:
@echo off
for /L %%a in (1 1 5) Do (
::%= ^
Multiline comments are supported. ^
Special characters work.<>;:%=* :) ^
Be carefull with double quotes though, they need to be even ! "" ^
Apart from a trailing caret, empty lines need at least one char to not break the multiline. ^
=%
echo ok
)
pause
Important Note, when using the commant like that it seems that you can't leave empty line after it so
the last =% must be followed by the echo ok not like the example above "it won't work"
I don't know if that what Ed Dyreen meant in his comment or not
Quote:
Apart from a trailing caret, empty lines need at least one char to not break the multiline.