一个数字是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.