Computing.Net > Forums > Disk Operating System > Save total hard disk size in a file

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.

Save total hard disk size in a file

Reply to Message Icon

Name: ajeshjohn
Date: June 20, 2006 at 23:19:44 Pacific
OS: DOS
CPU/Ram: Any
Product: Any
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: DAVEINCAPS
Date: June 21, 2006 at 00:11:17 Pacific
Reply:

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.


0

Response Number 2
Name: Mechanix2Go
Date: June 21, 2006 at 03:20:58 Pacific
Reply:

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


0

Response Number 3
Name: ajeshjohn
Date: June 21, 2006 at 05:14:51 Pacific
Reply:

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


0

Response Number 4
Name: Mechanix2Go
Date: June 21, 2006 at 05:47:38 Pacific
Reply:

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


0

Response Number 5
Name: LinuxOS2
Date: June 21, 2006 at 09:24:35 Pacific
Reply:

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


0

Related Posts

See More



Response Number 6
Name: DAVEINCAPS
Date: June 21, 2006 at 13:16:26 Pacific
Reply:

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.


0

Response Number 7
Name: Mechanix2Go
Date: June 21, 2006 at 20:11:30 Pacific
Reply:

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


0

Response Number 8
Name: ajeshjohn
Date: June 21, 2006 at 21:56:51 Pacific
Reply:

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


0

Response Number 9
Name: DAVEINCAPS
Date: June 21, 2006 at 22:30:05 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Replace Corrupt Files SCSI Software Emulation



Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Save total hard disk size in a file

include a file name as a field in a file? www.computing.net/answers/dos/include-a-file-name-as-a-field-in-a-file-/1076.html

How save in a file a find for strin www.computing.net/answers/dos/how-save-in-a-file-a-find-for-strin/11347.html

Can spindown damage hard disk www.computing.net/answers/dos/can-spindown-damage-hard-disk/6821.html