活动分区与最后分区确定的批处理(DOS/omnifs版)
@echo off
if %nhdd%.==. set nhdd=1
:BEGIN
if exist dpit2.ini del dpit2.ini >nul
if exist p_d.ini del p_d.ini >nul
omnifs /dl=%nhdd% diskinfo>omni_dd.txt
type omni_dd.txt|find /i "%nhdd%.1:" >nul
if errorlevel 1 goto fail
strings lines=LINESIZE omni_dd.txt
strings lines=add %lines%,2
set line=1
:omni
if %line%.==%lines%. goto omni_1
strings line=add %line%,1
strings lined=read omni_dd.txt,%line%
strings omn_row1=left %lined%,1
if not %omn_row1%.==%nhdd%. goto omni
echo %lined%|find /i "FAT" >nul
if not errorlevel 1 goto omni_6
echo %lined%|find /i "NTFS" >nul
if not errorlevel 1 goto omni_6
echo %lined%|find /i "Active" >nul
if not errorlevel 1 goto omni_6
goto omni
:omni_6
echo %lined%>>dpit2.ini
strings omn_row5=mid %lined%,5,1
if %omn_row5%.==:. goto omni_4
strings omn_row3=mid %lined%,3,1
strings omn_row4=mid %lined%,19,3
if not %actpw%.==. goto omni_5
strings omn_row5=mid %lined%,24,6
goto omni_5
:omni_4
strings omn_row3=mid %lined%,3,2
strings omn_row4=mid %lined%,20,3
if not %actpw%.==. goto omni_5
strings omn_row5=mid %lined%,25,6
:omni_5
if not %omn_row5%#==Active# goto omni_2
set actpw=%omn_row3%
:omni_2
set lastpw=%omn_row3%
if not %omn_row4%.==. echo %omn_row1%.%omn_row3% %omn_row4%>>p_d.ini
goto omni
:omni_1
if %actpw%.==. set actpw=1
cls
echo.
echo 第一硬盘活动分区是: %nhdd%:%actpw%
echo 第一硬盘最后分区是: %nhdd%:%lastpw%
goto exit_1
:fail
cls
echo.
echo Fail, 未能获取第一硬盘有效分区信息。
echo.
pause
rb
:exit_1
set line=
set lines=
set lined=
set omn_row1=
set omn_row3=
set omn_row4=
set omn_row5=
仅供参考。
欢迎批评指正。
[ 本帖最后由 lianjiang 于 2008-4-22 10:07 AM 编辑 ]
阅读(1871) | 评论(1) | 转发(1) |