|
检测硬盘容量并跳转.BAT
@ECHO OFF
setlocal enabledelayedexpansion
set /a k=1024,m=k*k,g=1
for /f "tokens=3" %%j in ('dir /-c A:\ 2^>nul') do set num=%%j
if not "!num1!"=="0" (
call :loop
for /f "delims=0 tokens=*" %%k in ("!j!") do set /a ok=%%k/g
if !ok! GTR 20 goto _end
GOTO _del
)
EXIT
:loop
set /a s=%y%%num:~0,1%/m,y=%y%%num:~0,1%%%m
set j=%j%%s%
if %y% equ 0 set y=
set num=%num:~1%
if not "%num%"=="" goto loop
goto :error
:_del
CLS
echo.
echo 当硬盘剩余容量^<20M时,执行这里的代码.
echo.
PAUSE
EXIT
:_END
CLS
echo.
echo 当硬盘剩余容量^>20M时,执行这里的代码.
echo.
PAUSE...
EXIT |
|