I'm writing a script where I want to give some help (calling with /?)
Now I tried with
REM This is myscript.bat
FOR %%A IN (%*) DO (
rem controllo i parametri
rem ...
if /I "%%A" equ "/?" goto :help
if /I "%%A" equ "--help" goto :help
if /I "%%A" equ "-h" goto :help
)
echo stuff
goto :out
:help
echo this is your lifesaver
:out
it works fine with myscript.bat --help' and myscript.bat -h (it prints this is your lifesaver).
If I call it like myscript.bat /? it prints stuff then exits instead of printing this is your lifesaver