批处理文件“和"是否为“陈述 [英] Batch-file "and if" statement

查看:74
本文介绍了批处理文件“和"是否为“陈述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我完全不知道如何为批处理文件创建如果"语句,希望在这里能有所帮助.

I have no idea at all how to make an "and if" statement for my batch file, and I hope I could get some help in here.

我要制作的行:

if %a%==X/O and if %b%==X/O goto done

推荐答案

批处理不支持if逻辑中的andor.您可以通过嵌套条件来模拟and.

Batch doesn't have support for ands or ors in if logic. You can simulate an and by nesting your conditions.

if %a%==X/O (
    if %b%==X/O (
        goto done
    )
)

类似地,您可以通过进行两次单独的检查来模拟or.

Similarly, you can simulate an or by having two separate checks.

if %a%==X/O goto done
if %b%==X/O goto done

这篇关于批处理文件“和"是否为“陈述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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