I am getting the error message "The system cannot find the drive specified." when I use multiple comment lines in the "do" portion of a "for" line in my batch file. OS is Windows Server 2003 and also happens on Windows XP.
I am using "::" to precede comments, which some sites recommended rather than "rem". (including http://www.experts-exchange.com/Programming/Q_20241272.html
Below is an example:
for %%D in (hi) do (
echo Before a comment
echo After a comment
Before a comment
The system cannot find the drive specified.
After a comment
If I omit Comment 2, it's fine (no error). If I omit Comment 1, it's fine. If I use "rem" for my comments, it's fine.
I can use "rem" to avoid the error, but I'd like to find out why it's happening, if anyone knows or has seen this before.... Perhaps it's just an undocumented (?) limitation of using colons for comments?