Thank you all for your helpful comments!
Does anyone think that this situation merits a sentence in the Command Grouping section, stating that labels shouldn't be used in a command group?
Tx,
John
Thanks, Charles, but I'm not convinced. :) Your explanation doesn't account for the error I got when removing the "goto end" statement. And it doesn't explain the behavior of this script:
if "%1" == "help" (
echo MARK 1
echo MARK 2
:foobar
echo MARK 3
)
Script invocation:
> test2 help
MARK...
Consider this batch program, stored in "test.btm":
@echo off
if "%1" == "" goto helplabel
if "%1" == "help" (
:helplabel
echo this
echo is
echo helpful
goto end
)
:end
With CMD.EXE, both "test" and "test help" produce the...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.