Here\'s one interesting thread. And I tried to play with the two things discussed there.
I'm always surprised, that you still found things that never came to my mind to test.
Contrary to Aacini, I don't believe that :/?
acts here as a valid label.
Else this should find such a label.
I suppose that the CALL
command is internally composed of a stack pusher function and then just use GOTO
to jump to the label.
And as you are using late expansion the /?
isn't detected by the CALL
command itself, but by the GOTO
command.
The goto
shows only the help info and finished, but as the call
has already pushed the fileposition to the stack it works like calling this filepostion and later return to the same location!
set "help=^ /?"
call :myLabel%%help%%
This shows also the help, like a GOTO :myLabel /?
would do.
But this one don't
set "help=/?"
call :myLabel %%help%%
I suppose, the GOTO gets only the label parsed by the CALL, the other parameters are moved to %1, %2, ...
And this could explain why only the label can use delayed expansion two times.
@echo off
setlocal EnableDelayedExpansion
set "label=myLabel"
set "pointer=^!label^!"
call :!pointer!
exit /b
:myLabel
echo it works