windows - Windows批处理文件中相当于NEQ、LSS、GTR等的符号

标签 windows batch-file if-statement cmd

在批处理中,我总是在使用 if 命令时使用 ==。 (例如:if "19"=="3"echo My computer doesn't know maths)

对于所有其他(LSSLEQNEQ 等)呢? 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/

相关文章:

windows - 如何在bat文件末尾添加计数

PYTHON:能够从同一个类中调用方法需要什么?

c - 未知类型名称 'uint32_t' , MinGW

windows - Windows 上的 Hudson - 错误 : java. io.IOException:无法运行程序 "sh"

batch-file - 批处理文件,将json文件读入字符串

Windows批处理文件获取C :\drive total space and free space available

java - 如何将 if 语句中设置的变量传递到代码的其余部分?

batch-file - 如何从 ffmpeg 到 ffplay 寻求 ffplay 或管道

java - 如何组合下面的 if 循环?

Java计算器不执行if语句