I have picked up following example to understand parsing of command line argument in BATCH file:
@echo off :Help echo sumit :GETOPTS if /I "%1" == "-h" call :Help if /I "%1" == "-b" set BASE=%2 & shift if /I "%1" == "-s" set SQL=%2 & shift shift if not "%1" == "" goto GETOPTS echo %BASE% echo %SQL%
Now, have few issues with it, :Help is called even if I don't pass -h option to my batch file during execution.
How it could be avoided ?
optgets.bat -b milan -s okaz sumit milan okaz
It shouldn't print sumit as I didn't pass -h option
Second, once done with execution it should unset the variable being set using command line arguments