The volumes - i.e. the total size of the C: drive and the
D: drive, etc.
DrvInfo.bat DriveLetter DSize FSpace Alloc
where DriveLetter is the Drive Letter,
DSize is a numeric environment variable name that will be set to the drive size
in KB.
FSpace is a numeric environment variable name that will be set to the Free
Space in KB.
Allooc is a numeric environment variable name that will be set to the
Allocation Unit (Cluster size) in bytes.
@echo off
if {%4}=={} @echo Syntax: DrvInfo DriveLetter DSize FSpace Alloc&exit /b 1
setlocal ENABLEDELAYEDEXPANSION
set work=%1
set drive=%work:~0,1%
if not exist %drive%: @echo DrvInfo: %1 does NOT exist&endlocal&exit /b 2
@echo KB total disk space.>%TEMP%\DrvInfo.tmp
@echo KB available on disk.>>%TEMP%\DrvInfo.tmp
@echo bytes in each allocation unit.>>%TEMP%\DrvInfo.tmp
set /a cnt=0
call
![Stick Out Tongue :p :p](/styles/default/custom/smilies/tongue.gif)
arse>nul 2>&1
del /q %TEMP%\DrvInfo.tmp
endlocal&set /a %2=%DSize%&set /a %3=%FSpace%&set /a %4=%Alloc%
exit /b 0
![Stick Out Tongue :p :p](/styles/default/custom/smilies/tongue.gif)
arse
for /f "Tokens=1" %%a in ('chkdsk %drive%: /I /C^|Findstr
/G:%TEMP%\DrvInfo.tmp') do (
REM The above 2 lines are 1 line
set /a cnt=!cnt! + 1
if !cnt! EQU 1 set DSize=%%a
if !cnt! EQU 2 set FSpace=%%a
if !cnt! EQU 3 set Alloc=%%a
)
Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com