有没有办法通过IF语句传递OR?
如:
SET var=two IF "%var%"=="one" OR "two" OR "three" ECHO The number is between zero and four.
没有.
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 "%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 )