|
贴一下BAT
@echo off
set drv=%1
set dfree=0
strings line=linesize ps.txt
set i=1
:loop
strings txt=read ps.txt,%i%
strings txt=left %txt%,20
rem 只考虑DISK 0
strings an=find %txt%,disk 1:
if not "%an%"=="0" goto exit
rem 标题行不要
strings an=find %txt%,disk 0:
if not "%an%"=="0" goto next
strings an=find %txt%,type
if not "%an%"=="0" goto next
rem 已经找到
strings drv0=left %txt%,5
strings an=find %drv0%,%drv%
if not "%an%"=="0" goto exit
rem 累加FREE分区数
strings an=find %txt%,free
if not "%an%"=="0" strings dfree=add %dfree%,1
:next
if %i%==%line% goto exit
rem 下一行
strings i=add %i%,1
goto loop
:exit
rem 变换为适合GHOST调用格式
strings fqh=left %txt%,2
echo %fqh%
strings an=find %txt%,primary
if not "%an%"=="0" strings fqh=add %fqh%,1
strings fqh=sub %fqh%,%dfree%
echo.
echo 1:%fqh% %drv% %dfree%
pause |
|