Using an OR in an IF statement WinXP Batch Script
No.
if "%var%"=="one" goto foo
if "%var%"=="two" goto foo
if "%var%"=="three" goto foo
goto afterfoo
:foo
echo The number is between one and three (technically incorrect, since it includes the end points and thus is not between).
:afterfoo
If you need a more structured approach:
if "%var%"=="one" set OneToThree=1
if "%var%"=="two" set OneToThree=1
if "%var%"=="three" set OneToThree=1
if defined OneToThree (
echo Foo
) else (
rem something
)
See duplicate question IF... OR IF... in a windows batch file where following solution proposed by @Apostolos
FOR %%a in (item1 item2 ...) DO IF {condition_involving_%%a} {execute_command}
e.g.
FOR %%a in (1 2) DO IF %var%==%%a ECHO TRUE
I found to be the most straight forward and simple to use case in my batch scripts.