title: Comparing 2 numbers in DOS Batch Not Working
body: <p>I'm an old-timer who is a newbie to DOS Batch programming.  I have what I <em>think</em> is a very simple batch script, that is <em>not</em> working.  I looked for similar posts, and didn't find one that matched.</p>
  
  <p>I am running the below script on XP.  My <em>goal</em> is to check for free disk space before proceeding further, but I ran into a problem <em>comparing 2 numbers</em>, so the below script contains only that logic.  I have hard-coded numbers to show the problem, which is...  The comparison (if x gtr y) seems not to work, and so the branch logic goes to the wrong place.  Either that, or I'm messing up somewhere else in the IF statement.  (Some of the echo statements are unnecessary - they are for debugging - but I left them in for now.)</p>
  
  <p>Any enlightenment on where I'm going wrong would be GREATLY appreciated.</p>
  
  <p>Thx...</p>
  
  <pre><code>@echo off
  
  set Free=217522712576
  set Need=20000000000
  
  echo Free=%Free%
  echo Need=%Need%
  
  echo on
  IF %Free% GTR %Need% (GOTO Sufficient_Space) ELSE GOTO Insufficient_Space
  @echo off
  
  :Insufficient_Space
  @ECHO INSUFFICIENT SPACE
  GOTO DONE
  
  :Sufficient_Space
  @ECHO SUFFICIENT SPACE
  
  :DONE
  </code></pre>