作者: zhxy9804 时间: 2013-4-20 10:48
@echo off
title 正在判定系统引导器类型……
color 1f
attrib -s -r -h >nul 2>nul
set disname=启动系统维护工具-20110210版
set timeout=3
if exist c:\boot.ini goto ntldr
if exist c:\boot\bcd goto bootmgr
goto nosys
:ntldr
title 系统启动属于ntldr类型,正在安装工具,请稍等……
type c:\boot.ini| find "\ZHANGHD.LDR" >nul && echo. && title 本工具已经安装,请退出。&& pause && goto clear
echo=>>c:\boot.ini
echo=>>c:\boot.ini
echo C:\ZTPE\GRUB\ZHANGHD.LDR="%disname%">>c:\boot.ini
bootcfg /timeout %timeout% >nul 2>nul
goto clear
:bootmgr
title 系统启动属于bootmgr类型,正在安装工具,请稍等……
set vid=
bcdedit >bcdtemp.txt
type bcdtemp.txt | find "\ZHANGHD.LDR" >nul && echo. && title 本工具已经安装,请退出。&& pause && del ntldr && goto clear
bcdedit /create /d "%disname%" /application bootsector >vid.ini
for,/f,"tokens=2 delims={",%%i,in (vid.ini) do (
set vida=%%i
)
for,/f,"tokens=1 delims=}",%%i,in ("%vida%") do (
set vid={%%i}
)
echo %vid%>vid.ini
bcdedit /set %vid% device boot >nul
bcdedit /set %vid% path \ZTPE\GRUB\ZHANGHD.LDR >nul
bcdedit /displayorder %vid% /addlast >nul
bcdedit /timeout %timeout% >nul
del ntldr >nul 2>nul
goto clear