一个数字是Windows批处理文件比另一个更大既少 [英] A number is both greater and less than another in a windows batch file

查看:530
本文介绍了一个数字是Windows批处理文件比另一个更大既少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下的code在我的批处理文件:

I have the following code in my batch file:

if %bakfilesize% geq %freespacet% echo baksize is larger
if %bakfilesize% leq %freespacet% echo baksize is smaller   

当我运行它,我在屏幕上得到以下的输出:

When I run it, I get the following output on screen:

if 399502220288 GEQ 463777075200 echo baksize is larger
baksize is larger

if 399502220288 LEQ 463777075200 echo baksize is smaller
baksize is smaller

谁能告诉我是怎么回事呢?我已经尝试了简单的版本与数字1和2,和窗口可以确认1确实是小于2,那么,为什么在这种情况下失败?

Can anyone tell me what is going on here? I have tried a simple version with the numbers 1 and 2, and windows can confirm that 1 is indeed less than 2, so why is it failing in this instance?

我只真正需要的GEQ语句来工作。另一种是在展示的古怪

I only really need the geq statement to work. The other one is in to demonstrate the oddness.

推荐答案

确定,在这种情况下,这个问题很简单。试试这个,因为它是在你的例子:

OK, in this case, the problem is quite simple. Try this as it is in your example:

set /a bakfilesize=399502220288

您将收到此错误:

无效号码。数字仅限于precision的32位。

Invalid number. Numbers are limited to 32-bits of precision.

因此​​,这意味着你正在处理的数字过大和DOS将无法给他们propperly比较。

So this means that the numbers you are handling are too big and DOS won't be able to compare them propperly.

这篇关于一个数字是Windows批处理文件比另一个更大既少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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