或者在批处理文件中无法正常工作

时间:2014-09-08 23:02:46

标签: batch-file

@echo off
cls
echo My own logic thinks an IF OR STATEMENT should work this way..
IF [1]==[1] echo good
IF [2]==[2] echo times
IF [1]==[2] echo this actually should not output
IF [1]==[1] OR [2]==[2] echo hello there (with or)
REM it told me 'or' is not recognized as an internal or external command, operable program or batch file.  

我还没有弄清楚OR的语法问题

1 个答案:

答案 0 :(得分:1)

批处理文件中没有OR条件。您需要创建自己的条件:

IF [1]==[1] (
  echo ok
) else (
  if [2]==[2] (
     echo ok
  ) else (
     echo not ok
  )
)