sonoop Posted April 16, 2011 Share Posted April 16, 2011 (edited) Hey everrybody!!!in command line (MS DOS), how to get freedisk space of the drive that installed application?My application's space is 1GB, I want to check freedisk space of the drive to know that has enough space for my application after my application installed.pls help me!!!Thanks!!! Edited April 19, 2011 by sonoop Link to comment Share on other sites More sharing options...
Tripredacus Posted April 17, 2011 Share Posted April 17, 2011 If using dos, likely need batch. Move to correct forum. Link to comment Share on other sites More sharing options...
sonoop Posted April 18, 2011 Author Share Posted April 18, 2011 sorry mod.I use batch to building GUI installation for my application, and I want to know "How to get freedisk space". Can I post here? Link to comment Share on other sites More sharing options...
allen2 Posted April 18, 2011 Share Posted April 18, 2011 The dir command would do the job but you'll need to parse it to get the last line. Read also on how to do it another way. Link to comment Share on other sites More sharing options...
sonoop Posted April 18, 2011 Author Share Posted April 18, 2011 @allen2: thank you!do you know to use freedisk.exe? Link to comment Share on other sites More sharing options...
Yzöwl Posted April 18, 2011 Share Posted April 18, 2011 I'd suggest that you would enter the amount of space you require to have free as a parameter and the utility would return 0 for yes and 1 for no.If your question is not a mistake you will need to bear in mind that some methods of checking on MS-DOS 5 will suffer at 1Gb and completely fail at over 2Gb. 1Gb does seem like a very large requirement for that Operating System. I think that the standard method of manually checking free disk space was to issue chkdsk [drive]: Link to comment Share on other sites More sharing options...
sonoop Posted April 18, 2011 Author Share Posted April 18, 2011 @Wise Owl: thank you!I get value "59451776 KB available on disk." by chkdsk command, how to get this value compare with value of my application?My application is need 50GB free disk space. Link to comment Share on other sites More sharing options...
Yzöwl Posted April 18, 2011 Share Posted April 18, 2011 Since you are working in kilobytes you would need to multiply your gigabytes figure by 1048576 and use that for your check.i.e. 50 GB x 1048576 = 52428800 kB(As you can see, in this case your 59451776 kB is sufficient to accomodate your requirements)Please note that you should never fill a hard disk to capacity, (you may be advised to allow for extra as a safety factor) Link to comment Share on other sites More sharing options...
allen2 Posted April 18, 2011 Share Posted April 18, 2011 How do you get 50GB on one partition when dos 5 only support FAT partition and FAT partition can't be more than 4GB if i remember correctly ?And no i don't know freedisk.exe. Link to comment Share on other sites More sharing options...
sonoop Posted April 19, 2011 Author Share Posted April 19, 2011 @Mod: thanks, I know, But I cant write a command to compare. can you show me code?@allen2: that's my exp. my mean is "get free disk space of a drive to compare with my app's space need". Can you show me code use chkdsk, dir, fsutil? Link to comment Share on other sites More sharing options...
CoffeeFiend Posted April 19, 2011 Share Posted April 19, 2011 As said before, chkdsk was the common way back then.My application is need 50GB free disk space.Then checking for space is useless: it'll always return false. MS-DOS 5 only supports FAT12 (for floppies) and FAT16 (for hard drives) which is limited to 2GB* so you'll NEVER have 50GB free. You will never have more than 2GB free (that would be a 100% empty drive of the biggest size you can use). Checking for disk space is completely trivial (I would simply call int 21 with ah=36h and dl=3), but bypassing such a design limitation of FAT16 is just not possible. Even trying to parse the output of chkdsk which simply returns bytes/sector (512) * sectors/cluster (64 max) * amount of free clusters (max 65536) is pointless: the max it could ever display is 2147483648 bytes, and that's still 48GB short of what you need. Your current drive * 2^16 clusters @ 32KB/ea max (64KB clusters not supported) = 2GB max.Edit: unless you're mixing up MB and GB, or aren't using MS-DOS 5, or somehow using another non-native filesystem that's tacked on by hooking interrupts or such, then it's a completely different story.Edit2: why did you say you're using MS-DOS 5 when you're using XP? Link to comment Share on other sites More sharing options...
sonoop Posted April 19, 2011 Author Share Posted April 19, 2011 (edited) sorry all, i cant speak english verry well.I building a GUI Installation for my application, and I write a script with wizapp like a batch file in command line. My application need space free of the drive, and I want to check free disk space after my application installed.How to check......... (in command line)?chkdsk, dir, fsutil --> show string value free freedisk.exe --> return 0 if there is enough space and return 1 if there isnt.download freedisk.exe http://www.mediafire.com/?eio9qcg5mtr58kl copy to drive Dcode:freedisk.exe D: 59825229820 (small than freedisk space)result: to small!!! (return 1) --> it's wrong.....And I'm so sorry all about version dos confusion.Thank you!!! Edited April 19, 2011 by sonoop Link to comment Share on other sites More sharing options...
Yzöwl Posted April 19, 2011 Share Posted April 19, 2011 So which Operating system(s) is your application compatible with? Link to comment Share on other sites More sharing options...
sonoop Posted April 19, 2011 Author Share Posted April 19, 2011 @Owl: My OS is WIN XP SP 2, My app run with os compatible. I only build GUI for Installation. Link to comment Share on other sites More sharing options...
Yzöwl Posted April 19, 2011 Share Posted April 19, 2011 Its no good providing a command line for XP (with service pack 2) if users of previous operating systems could potentially install the application. The parsing of output from commands such as DIR can change according to the OS, FSUTIL is not available on all OS's.What is your application, it will very likely already have been coded to check for disk space as part of it's routine? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now