本帖最后由 terse 于 2015-6-9 12:02 编辑
- @echo off&setlocal enabledelayedexpansion
- set Md=1048576
- for /f "skip=1tokens=1,2" %%a in ('wmic logicaldisk where "drivetype='3'" get name^,freespace') do (
- for /f %%a in ("%%a") do if not defined b (
- for /f "tokens=*" %%i in ('dir /ad/s/b %%b^|findstr /iec:"\AAA\BBB"') do (
- for /f "tokens=*" %%i in ("%%i") do (
- set "len=0"
- set "free=%%a00"
- set "s=!free!"
- for %%i in (16 8 4 2 1) do if "!s:~%%i!" neq "" set/a len+=%%i&set "s=!s:~%%i!"
- set/a "rder=!free:~,8!%%Md,g=!free:~,8!/Md"
- for /l %%j in (8 1 !len!) do (
- set/a "qent=!rder!!free:~%%j,1!/Md,rder=!rder!!free:~%%j,1!%%Md"
- set "g=!g!!qent!"
- )
- if !g! lss 1024000 (
- for /f "tokens=*" %%j in ('dir /a-d/o-d/b "%%i" 2^>nul') do (
- set "b=%%i\%%j"
- )
- )
- )
- )
- )
- )
- if defined b echo;!b!
- pause
复制代码
|