Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to compare two numbers if they are greater than 32 bit integer in dos in a 32 bit system? The two numbers are the size of folders in bytes. Can somebody help me please?

share|improve this question
Are you referring to MS-DOS or the command line interpreter that comes with Windows XP/Vista/7? – Darth Android Oct 11 '12 at 15:47
cammand line interpreter – Sachin Oct 11 '12 at 15:48
@Sachin - The command prompt is a 32-bit process. This means that an integer is its normal size. – Ramhound Oct 11 '12 at 16:22
if powershell is an option, it's easiest: it will auto choose either int32 or int64 so this runs fine: powershell 10000000000 -ge 20000000000000 – wmz Oct 11 '12 at 16:28
I went ahead and remove the ms-dos tag since it clearly indicates NOT to use it for command prompt questions. – Ramhound Oct 11 '12 at 16:44

The idea of techie007 is actually usable when using padded strings instead of numbers:

set num1=666123456789
set num2=123450123456789
set "tmp1=               %num1%"
set "tmp2=               %num2%"
set pad1="%tmp1:~-15%"
set pad2="%tmp2:~-15%"
if %pad1% gtr %pad2% …

In this code you can compare 2 numbers with up to 15 digits:

  • numX hold the number strings
  • tmpX hold the number strings prefixed with 15 spaces
  • padX hold the last 15 characters in quotes —> padded number strings, now ready for comparison!

Better put this in a subroutine if you need to compare more numbers, or if applicable, sort the padded strings via the available sort command.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.