How can I use multiple conditions in “If” in batch file?

后端 未结 3 1819
余生分开走
余生分开走 2021-02-04 15:06

Can I specify multiple conditions with \"or\"/\"and\" in batch file if block?

If not that complex, can I at least use something like:

if val         


        
3条回答
  •  时光说笑
    2021-02-04 15:52

    You can break your condition into 2 and use if and if for setting 2 conditions

    if %value% GTR %value1% (
    echo Value is greater that %value1% ) else call :Error
    if %value% LSS %value2% (
    echo Value is less than %value2% ) else call :Error
    ::Write your Command if value lie under specified range
    exit
    
    :Error
    echo Value doesn't lie in the range 
    ::Write your command for if value doesn't lie in the range
    exit
    

提交回复
热议问题