Within a Windows Batch script, how can I check if a given parameter is set in any position? For example, say I called myscript.bat
, as follows:
myscript.bat /foo /bar
I want to determine if /foo
is set I could do:
if "%1" == "/foo" echo "/foo is set"
But say now I call the script as follows:
myscript.bat /bar /foo
The above code no longer echos /foo is set
.
How can I write an if
condition such that is true whether /foo
is in any position? Does Windows Batch provide a simple way of doing this without having to check every parameter in a for loop?