Is there a way already to check the free space of a hard drive in a batch script?
I'd rather not use third party apps since I need to fill out a lot of forms, and in that case I think I'll write a small app myself.
|
feedback
|
|
The easiest way to reliably get at the free disk space is using WMI. When trying to parse the output of
This will output something like
You can force this into a single line by adding the
There are a few empty lines there, though (around three or four) which don't lend themselves well for processing. Luckily the
The nice thing here is that since we're only using the second token all empty lines (that don't have a second token) get ignored. Remember to double the
You can now use the free space which is stored in the environment variable | ||||
|
feedback
|
|
Here is a simple script to check your c-drive echo C-drive Free Space >> CDrive.txt dir c:\|find /i "bytes free" >> CDrive.txt | |||
|
feedback
|
|
ok, so how would i use this techinque to compare space used on a source against free space on a backup? i thought to use freedisk, but its output is not 1 or 0! | |||
|
feedback
|