本帖最后由 pcl_test 于 2015-3-4 23:51 编辑
回复 1# 梦缘隋都 - @echo off
- setlocal enabledelayedexpansion
- for /f "tokens=1-3 delims= " %%i in ('wmic logicaldisk where "drivetype=3" get name^,size^,freespace ^|findstr "[0-9]"') do (
- >temp.vbs echo,a=%%i
- >>temp.vbs echo,b=%%k
- >>temp.vbs echo,s=b/1024/1024/1024
- >>temp.vbs echo,fs=a/1024/1024/1024
- >>temp.vbs echo,n=a/b*100
- >>temp.vbs echo,wscript.echo round^(s,2^),round^(fs,2^),round^(n^)
- for /f "tokens=1-3 delims= " %%a in ('cscript /nologo temp.vbs') do set "size=%%a" & set "freesize=%%b" & set "usage=%%c"
- set /a usage=100-!usage!
- del temp.vbs 2>nul
- if !usage! gtr 80 echo,盘符%%j 总空间!size!GB 剩余空间!freesize!GB 使用率!usage!%%
- )
- pause
复制代码
|