gpt4 book ai didi

windows-xp - Windows批处理文件: multiple if conditions

转载 作者:行者123 更新时间:2023-12-03 06:45:53 25 4
gpt4 key购买 nike

有没有办法这样说

if %1 == 1 or %1 == 2

在批处理文件中?或者,如果我可以指定一组候选值,例如

if %1 in [1, 2, 3, 4, ... 20]

最佳答案

事实证明“and”很简单——只是不是您期望的语法:这 3 个例子说明了这一点。

换句话说:If 1==1 AND 2==2 then echo "hello"

if 1==1 echo hello
hello

if 1==1 if 2==2 echo hello
hello

if 1==1 if 2==1 echo hello
(nothing was echoed)

关于windows-xp - Windows批处理文件: multiple if conditions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6060046/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com