Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi, Can anyone tell me how to know the total hard disk size in DOS. "fdisk" (option 4) is an option, but I want the information stored in a file. I tried to redirect the information using "fdisk /status > file.txt". But it just created an empty file.
Thanks for the help...
Thanks,
Aju

I don't think there's native dos commands to do that. Try googling dos "screen dump" or dos "screen capture". That way you'd run fdisk/status and then run the screen dump software. You could probably combine the commands in a batch file.
Interestingly, there is a screen capture in windows. If you have a dos box open and hit ALT-PRINT SCREEN it copies the screen contents to the clipboard. Close the box and run notepad, right click and PASTE. The dos screen contents are now a text file.

Since this:
fdisk /status > file.txt
gave you an empty file, I guess the result does not go to stdout. Strange, but since /status is one of those 'undocumented' switches, all bets are off.
I don't have DOS running to test it. Did you get the output on screen?
If at first you don't succeed, you're about average.M2

Hi,
Yes, I also assume that the output of "fdisk /status" does not go to the stdout. But isn't it strange? I was expecting all the commands to work in a similar manner.
Dave, I did not want to use any other utilities, but to devolop one of my own. In fact I just want to know the total size of a hard disk. So I thought I'll redirect the output of fdisk and later parse the file to get the info.
And mechanix, I did get the output on the screen. Its the same output that you get when you run "fdisk" and select option-4.
Thanks,
Aju

I guess the approach to take is a BIOS call.
You do want the size of the DRIVE, right? Not the size of a PARTITION, which you could get from the partition table.
hmmm...Is the DRIVE size also in the partition table?
If at first you don't succeed, you're about average.M2

How about the old pipe command, maybe try this:
dir > dir.txt
this will create a .txt file with the info I think you want ?
Keep the old stuff running

Yeah I was kind of surprised fdisk/status>file.txt didn't work. That's why I thought you may need to use one of the screen capture utilities. Dir>dir.txt does work but of course you only get a directory list and not fdisk/status results.
I think we might be missing something minor. The file is created so the syntax would seem to be OK.

Hi DAVEINCAPS,
I believe the [blank] file is created because nothing goes to stdout.
If at first you don't succeed, you're about average.M2

Hi Dave/Mechanix,
I do not think if I had not typed fdisk command correctly. I had tried so many times to get something into that file. As MECHANIX said the output might not be going to the stdout.And "dir >dir.txt", it would not work when i have a new hard disk(unformatted). Would it? And I want the total size of the hard disk.
I dont know if I should ask this in this forum. But have you ever heard of any solution in C or even in assembly language?
Thanks
Thanks,
Aju

If you mean using dir>file.txt because it'll show the free space then chkdsk>file.txt may be better. But both would need the drive to be partitioned and formatted whereas the fdisk command (if it would work) could be used on a drive in any state.

![]() |
Replace Corrupt Files
|
SCSI Software Emulation
|

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