在批处理中,我总是在使用 if
命令时使用 ==
。 (例如:if "19"=="3"echo My computer doesn't know maths
)
对于所有其他(LSS
、LEQ
、NEQ
等)呢? NEQ
没有类似 !=
的东西,还是我在想 Unix?
我想使用符号的原因是因为我认为有人说过对于文本或数字符号比使用文本变体更有效。
不管怎样,我还是想知道。谢谢。
最佳答案
运营商喜欢>
的原因不使用是因为它们在 shell 脚本中有特殊含义。 >
用于重定向输出; <
用于重定向输入等。
documentation from Microsoft列出以下运算符:
Operator | Description
EQU | equal to
NEQ | not equal to
LSS | less than
LEQ | less than or equal to
GTR | greater than
GEQ | greater than or equal to
另外单词not
用于否定条件。
The reason I want to use symbols is because I thought someone had said for either text or numbers symbols were more efficient than using the text variants.
他们可能指的是 bash 及其 large catalog的运营商。它为整数和字符串操作数提供了不同的运算符。
关于windows - Windows批处理文件中相当于NEQ、LSS、GTR等的符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47385508/