I would like to know if it is possible to make a more elegant solution for a batch file accepting arguments from another script. Looked at the solution here: Windows Bat file optional argument parsing, but can't make it work.
I have 19 arguments passed to the batch file. Arguments from the 7th are optional (come from checkboxes).
I have a working code with this structure:
REM arg7 parsing
set LOGFILE=%7
if not "%LOGFILE%" == "LOGFILE" (
set LOGFILE=
) else (
shift /7
)
REM arg8 parsing
set ARG8=%7
if not "%ARG8%" == "ARG8" (
set ARG8=
) else (
shift /7
)
REM arg9 parsing
set ARG9=%7
if not "%ARG9%" == "ARG9" (
set ARG9=
) else (
shift /7
)
And so on for each optional argument.
But now there are a lot of lines of similar code and it feels to me it could be optimized somehow. I'm not very familiar with batch scripting, so my tries of storing arguments in a list and trying to apply the above mentioned solution didn't work.