marxbalz
asked on
How to Assign Drive Space total\used to a variable?
Hi Gurus,
How do i assign the Drive capacity and space used to a variable from a DOS batch file? Do we have a command
that would do this.
Any input would be appreciated.
thank you
How do i assign the Drive capacity and space used to a variable from a DOS batch file? Do we have a command
that would do this.
Any input would be appreciated.
thank you
What operating system are you using?
ASKER
WINDOWS 2000 ADVANCED SERVER and some NT 4.0 Servers also.
for /f "usebackq tokens=3 delims= " %i in (`dir ^| find "bytes free"`) do @set FreeSpace=%i
This will set the environment variable "freespace" equal to the free space value returned by dir
This will set the environment variable "freespace" equal to the free space value returned by dir
Important to note if you are not familiar with the for command, that the single quotes just inside the parenthesis are backquotes - the unshifted ~ on most US keyboards
backquote=`
apostrophe='
backquote=`
apostrophe='
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanx. Happy to help! : )
dir /s | find "bytes free"
to display available disk space, but I am not sure where to take this from here.