Computing.Net > Forums > Programming > Compare two numbers w/Batch

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Compare two numbers w/Batch

Reply to Message Icon

Name: masimar
Date: October 12, 2007 at 07:17:22 Pacific
OS: Na
CPU/Ram: Na
Product: Na
Comment:

I'm working on a backup batch program to copy directories to a pen drive somewhat automatically and thought it would be nice to check available space on the pen drive before going through the whole xcopy process on a large directory. I really just need to compare two numbers and determine which is larger but I'm stumped. I've googled my fingers raw.
Can anybody help? The following are examples. 1) directory size, 2)available space

Thanks in advance.

1,307,791,263

1,254,895,616

Mark



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: October 12, 2007 at 12:49:02 Pacific
Reply:

What you want to achieve is related to the OS you are running, i.e. that is easy under NT kernel systems (Win NT/2K/XP) but hard in DOS based environments (Win 9X/ME).

Assuming you are running a NT Windows, the code is

Set DirSize=1,307,791,263
Set DirSize=%DirSize:,=%
Set AvSpace=1,254,895,616
Set AvSpace=%AvSpace:,=%

If %DirSize% gtr %AvSpace% GoTo :TooHuge

To know more type If /? at prompt (Win NT/2K/XP only).


0

Response Number 2
Name: masimar
Date: October 13, 2007 at 19:58:07 Pacific
Reply:

Thanks dor the response.

Yeah, I forgot to say it was NT. What you described is just what I wanted.

Thanks

Mark


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Compare two numbers w/Batch

Find then compare two #'s in batch www.computing.net/answers/programming/find-then-compare-two-s-in-batch/17217.html

Comparing files/ lists with batch www.computing.net/answers/programming/comparing-files-lists-with-batch/12686.html

Compare two text files with spaces www.computing.net/answers/programming/compare-two-text-files-with-spaces/19886.html