I need to be able to pass parameters to a windows batch file BY NAME (and NOT by order). My purpose here is to give end user the flexibility to pass parameters in any order, and
:parse
IF "%~1"=="" GOTO endparse
ECHO "%~1"| FIND /I "=" && SET "%~1"
SHIFT /1
GOTO parse
:endparse
This code checks all the parameters, strips all the outer quotes, and if equal sign is present, sets variable to value.
Use it like this:
yourbatch.bat "foo=bar" "foo2=bar2"
based on this answer: Using parameters in batch files at DOS command line, and edited in response to the edit attempt by D.Barev