|
再来个 fsutil 的
- @echo off
- setlocal ENABLEDELAYEDEXPANSION
- for /f "delims=" %%c in ('fsutil fsinfo drives') do (call :x_drv %%c)
- pause
- goto :eof
- :x_bit
- rem 用于计算传递过来的 字符串参数 的字符个数。 返回变量 bit1
- set "str1=%1"
- for /l %%r in (0,1,18) do (
- if not "!str1:~%%r,1!"=="" (
- set bit1=%%r
- )
- )
- exit /b
- :x_drv
- set bit=0
- set free1=0
- set free2=0
- :loop1
- shift
- if exist %1 (
- set /a n=0
- for /f "tokens=2 delims=#:^(" %%j in ('fsutil volume diskfree %1') do (
- set /a n=!n!+1
- if !n! equ 1 (
- call:x_bit %%j
- set free=%%j
- set free=!free: =!
- set free22=!free:~-9!
- if !bit1! geq 9 (set free11=!free:~0,-9!) else (set free11=0)
- if !bit1! geq !bit! (
- set bit=!bit1!
- if !free11! geq !free1! (
- if !free11! gtr !free1! set free2=!free22!
- set free1=!free11!
- if !free22! geq !free2! (
- set free2=!free22!
- set drv=%1
- )
- )
- )
- if "!drv!"=="%1" ( echo %1 !free11!,!free22! *) else (echo %1 !free11!,!free22!)
- )
- )
- )
- if not "%2"=="" goto loop1
- echo.
- echo !drv! !free1!!free2!
- exit /b
复制代码 |
|