данный скрипт позволяет определить свободное место на томе
Код:
@echo off
setlocal ENABLEEXTENSIONS
call :kBytesFree
pause
exit
:kBytesFree drive ret -- returns the free space of
:: a drive in kilobytes
:: -- drive [in] - drive letter, default is c:
:: - ret [out,opt] - varref returns number of bytes free
:$created 20060101 :$changed 20080219 :$categories FileInfo
:$source http://www.dostips.com
SETLOCAL
SET "drive=%~1"
IF "%drive%"=="" SET "drive=C:"
FOR /f "tokens=3 delims= " %%a ^
in ('"dir %drive%\|find /i "bytes free""') do set free=%%a
IF "%free%"=="" (
FOR /f "tokens=3 delims= " %%a in ^
('"dir %drive%\|find /i "байт свободно""') do set free=%%a
)
SET "free=%free:,=%" &rem eleminate commas in number
SET "free=%free:.=%" &rem eleminate dots in number
SET "free=%free: =%" &rem eleminate blank in number
SET "free=%free:~0,-3%" &rem divide by 1000 by cutting
rem off the last 3 digits
( ENDLOCAL & REM RETURN VALUES
IF "%~2" NEQ "" (SET "%~2=%free%") ELSE echo.%free%
)
EXIT /b