Hi, Im new here (But not to FreeBASIC), and I was wondering if anybody knew how to get the label and Free/total disk space from a given drive? and possibly the model name?
Thanks in advance.
Drive Information?
Use the "shell" command.
Just use shell to access the command.com
Then use simple OS command line commands and save the output; just redirect it to a text file.
For example, to get the name of the harddrive, use the Volume command and pipe it to a text file (then read the text file later).
That will shell out to the command prompt run the "vol" command and send the results to a newly created file named hdd_labl.txt which you can open and read later.
For disk size the directory command (dir) has a bunch of options.
the last two lines always output, are the the number of files in the current directory (folder) and the free disk space.
The output will look something like this:
Now good practice is to use specific file extensions for easier recognition by others - so if you forget to 'cleanup' they might know what the file is.
Suggestions:
TXT (text)
LST (list)
TMP (temp)
$$$ (string-temp)
$ (string temp)
QB (qbasic)
Another best practice would be to just "kill" the file after you are done with it, using the BASIC KILL command.
Hope this helps.
Then use simple OS command line commands and save the output; just redirect it to a text file.
For example, to get the name of the harddrive, use the Volume command and pipe it to a text file (then read the text file later).
Code: Select all
SHELL "vol > hdd_labl.txt"
For disk size the directory command (dir) has a bunch of options.
the last two lines always output, are the the number of files in the current directory (folder) and the free disk space.
The output will look something like this:
Code: Select all
Volume in drive C has no label.
Volume Serial Number is 686B-F0F2
Directory of C:\
04/13/2009 07:27 AM <DIR> 7b6bee7553a7b2f5ce2dda1d
01/30/2007 12:24 PM <DIR> 8c3127ede316849a3e19bd723f
12/08/2006 05:16 PM 0 CONFIG.SYS
04/15/2009 07:40 AM <DIR> Documents and Settings
05/29/2009 09:53 AM <DIR> Program Files
04/27/2009 07:51 AM <DIR> QBasic
03/11/2009 10:53 AM <DIR> QuickBas
08/06/2009 04:30 PM <DIR> Temp
08/10/2009 07:48 AM <DIR> WINDOWS
1 File(s) 1,892,240 bytes
8 Dir(s) 35,276,324,864 bytes free
29 Dir(s) 35,276,324,864 bytes free
Suggestions:
TXT (text)
LST (list)
TMP (temp)
$$$ (string-temp)
$ (string temp)
QB (qbasic)
Another best practice would be to just "kill" the file after you are done with it, using the BASIC KILL command.
Hope this helps.
-
- Newbie
- Posts: 2
- Joined: Mon Aug 10, 2009 3:16 am