本帖最后由 梦缘隋都 于 2015-3-23 12:22 编辑
- for /f "skip=1 tokens=1,2,3 delims= " %%i in ('wmic logicaldisk where "drivetype=3" get name^,size^,freespace') do (
-
- for /f %%a in ("%%i") do (
-
- set /a n+=1
-
- set AAA=%%i
-
- set BBB=%%k
-
- rem 循环取值
-
- call :division !BBB! 1073741824 quote 2
-
-
- call:division !AAA! !BBB! quot 2
- set degree=0.8
- echo 盘符%%j 空间!quote!GB 使用率为!quot!
-
- )
-
-
- )
复制代码 这段代码,需要在echo前面做一个判断 if !degree! lss !quot2! 则 输出 echo 盘符%%j 空间!quote!GB 使用率为!quot!
即想把使用率大于80%(这里是0.8)的磁盘分区信息打印出来,如果不是for在外面 就可以实现比较,但是在for里面就不知道该怎么实现了 ~~ |