我怎样才能在与QUOT使用多个条件;如果"在批处理文件? [英] How can I use multiple conditions in "If" in batch file?

查看:157
本文介绍了我怎样才能在与QUOT使用多个条件;如果"在批处理文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以指定多个条件或/和批处理文件如果阻止?

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 value1 < value < value2

基本上我的目的是检查当前系统时间是否在一定的时间间隔(2.05调幅和55分是precise),如果是的话,执行某些命令。

Basically my purpose is to check whether current system time falls in a certain interval(2.05 AM and 7.55 AM to be precise) and if it does, to execute certain commands.

推荐答案

添加到dbenham的回答,您可以使用,如果组合模拟两个逻辑运算符(AND,OR)转到语句。

Adding to dbenham's answer, you can emulate both logical operators (AND, OR) using a combination of if and goto statements.

要测试的条件1和codition2 的:

    if <condition1> if <condition2> goto ResultTrue

:ResultFalse
REM do something for a false result
    goto Done

:ResultTrue
REM do something for a true result

:Done

要测试的条件1或codition2 的:

    if <condition1> goto ResultTrue
    if <condition2> goto ResultTrue

:ResultFalse
REM do something for a false result
    goto Done

:ResultTrue
REM do something for a true result

:Done

标签当然是任意的,只要它们是唯一的,你可以选择自己的名字。

The labels are of course arbitrary, and you can choose their names as long as they are unique.

这篇关于我怎样才能在与QUOT使用多个条件;如果&QUOT;在批处理文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆