Windows批处理文件中等效于NEQ,LSS,GTR等的符号 [英] Symbol equivalent to NEQ, LSS, GTR, etc. in Windows batch files

查看:2884
本文介绍了Windows批处理文件中等效于NEQ,LSS,GTR等的符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在批处理中,当使用 if 命令时,我总是使用 == 。 (例如:如果19==3echo我的电脑不知道数学



怎么样?对于所有其他人( LSS LEQ NEQ 等)?对于 NEQ ,是不是像!= ,或者我在想Unix?



我想使用符号的原因是因为我认为有人说文字或数字符号比使用文字变体更有效。



<无论哪种方式,我还是想知道。谢谢。

解决方案

未使用> 等运算符的原因是因为它们在shell脚本中有特殊含义。 > 用于重定向输出; < 用于重定向输入等。



来自Microsoft的文档,列出了以下运算符:

 运算符|描述
EQU |等于
NEQ |不等于
LSS |低于
LEQ |小于或等于
GTR |大于
GEQ |大于或等于

此外,一词不是用于否定条件。


我想使用符号的原因是因为我认为有人说过文字或数字符号比使用文本变体更有效。


他们可能是指bash及其大型目录。它为整数和字符串操作数提供不同的运算符。


In batch I always use == when using the if command. (For example: if "19"=="3" echo My computer doesnt know maths)

What about for all of the others (LSS, LEQ, NEQ, etc.)? Isn't there something like != for NEQ, or am I thinking Unix?

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.

Either way, I'd still like to know. Thanks.

解决方案

The reason operators like > are not used is because they have special meanings in shell scripts. The > is used to redirect output; < used to redirect input, etc.

The documentation from Microsoft, lists the following operators:

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

In addition the word not is used to negate a condition.

The reason I want to use symbols is because I thought someone had said for either text or numbers symbols were more efficent than using the text variants.

They were probably referring to bash and its large catalog of operators. It provides different operators for integer and string operands.

这篇关于Windows批处理文件中等效于NEQ,LSS,GTR等的符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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