Logical operators (“and”, “or”) in DOS batch
问题 How would you implement logical operators in DOS Batch files? 回答1: You can do and with nested conditions: if %age% geq 2 ( if %age% leq 12 ( set class=child ) ) or: if %age% geq 2 if %age% leq 12 set class=child You can do or with a separate variable: set res=F if %hour% leq 6 set res=T if %hour% geq 22 set res=T if "%res%"=="T" ( set state=asleep ) 回答2: The IF statement does not support logical operators ( AND and OR ), cascading IF statements make an implicit conjunction. IF Exist File1.Dat