Supposing you have the following code snippet:
@echo off
call :SUB /?
exit /B
:SUB
>&2 echo %*
exit /B
The call
command recognises the /?
switch and displays its help message. How can I pass that argument over to the sub-routine, so that it is only processed there but not by the call
command? Is there a clever escape sequence to accomplish that?
So far I tried some escape sequences like call :SUB ^/?
, call :SUB /^?
, call :SUB ^/^?
, call :SUB^ /?
, and also the odd syntax call :SUB(/?
(which does not throw a syntax error surprisingly; similar to the widely used syntax for safe echo(
), but no luck so far.
In the command prompt, the same problem arises when writing something like call echo /?
.