I am an old timer who is new to DOS Batch programming. I have what I think is a very simple script batch that doesn't work. I searched for similar posts and did not find what matched.
I am running the below script on XP. My goal is to check the free disk space before continuing, but I ran into the problem of comparing two numbers, so the script below contains only this logic. I have hardcoded numbers to show a problem that ... Comparison (if x gtr y) doesn't seem to work, so the branching logic goes the wrong way. Either that, or I'll get confused somewhere else in the IF statement. (Some of the echo instructions are not needed - they are for debugging, but I left them now.)
Any enlightenment about where I would be wrong would be greatly appreciated.
thanks...
@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
source share