I guess this is a known windows batch problem, but it took me WAY too long to figure out...
It turns out that windows batch has a comment command "REM" that is ugly, and a commonly used and documented convention where you precede comments with a double colon "::", which is a little bit prettier.
But double-colon comment have a bug. The following batch file will cause a "cannot find the drive" error!
if "%1"=="" (
:: comment1
:: comment2
echo foo
)
This is apparently because "::" isn't REALLY a comment command of any kind; it's actually a label. An empty label, which therefore can't be used as a target of GOTO or CALL or anything, and therefore isn't "executed." But cmd.exe doesn't like having two empty labels inside the same () block. Or something. Grrrr...
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.