|
这是自己用的,楼主可以自己改一下:
@ECHO OFF
@CD /D "%~DP0"
SET /P IName=输入安装[GRLDR.MBR]的文件名,如:PELDR.MBR,注意大小写。
SET /P IPart=输入安装[%IName%]的盘符,如:C:。
SET VID=
BCDEDIT.EXE >"%TEMP%\BCDTEMP.TXT"
TYPE "%TEMP%\BCDTEMP.TXT" | FIND "\%IName%" >NUL && ECHO. && ECHO [BCD]中已经存在[%IName%]项,请检查是否安装正确。 && ECHO. && PAUSE && GOTO EXIT
@RD /S /Q "\\?\\%IPart%\BOOT_BAK\" >NUL
@MD "%IPart%\BOOT_BAK\"
BCDEDIT.EXE /EXPORT "%IPart%\BOOT_BAK\BCD_BAK" >NUL
BCDEDIT.EXE /CREATE /D "PE&TOOLS" /APPLICATION BOOTSECTOR >"%TEMP%\VID.TXT"
FOR,/F,"TOKENS=2 DELIMS={",%%I,IN (%TEMP%\VID.TXT) DO (SET VIDA=%%I)
FOR,/F,"TOKENS=1 DELIMS=}",%%I,IN ("%VIDA%") DO (SET VID={%%I})
ECHO %VID%>"%TEMP%\VID.TXT"
BCDEDIT.EXE /SET %VID% DEVICE PARTITION="%IPart%" >NUL
BCDEDIT.EXE /SET %VID% PATH "\%IName%" >NUL
BCDEDIT.EXE /DISPLAYORDER %VID% /ADDLAST >NUL
BCDEDIT.EXE /TIMEOUT 3 >NUL
IF EXIST "%IName%" COPY "%IName%" "%IPart%" /Y /V && GOTO EXIT
ECHO.
ECHO 请复制[%IName%]到[%IPart%]根目录,如:%IPart%\%IName%。
ECHO.
PAUSE
:EXIT
@DEL /F /A /Q "%TEMP%\BCDTEMP.TXT" >NUL
@DEL /F /A /Q "%TEMP%\VID.TXT" >NUL
@EXIT |
|