逻辑运算符("和","或QUOT;)在DOS批处理 [英] Logical operators ("and", "or") in DOS batch

查看:410
本文介绍了逻辑运算符("和","或QUOT;)在DOS批处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你将如何实现逻辑运算符在DOS批处理文件?

How would you implement logical operators in DOS Batch files?

推荐答案

您可以做嵌套条件:

if %age% geq 2 (
    if %age% leq 12 (
        set class=child
    )
)

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
)

这篇关于逻辑运算符("和","或QUOT;)在DOS批处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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