|
好久以前自写自用的,少的文件请自行找补,附代码,保存为CMD,谢谢。
- @ECHO OFF
- @TITLE [WIM2VHD]
- @CD /D "%~DP0"
- @SET SYSPATH=C:
- :MENU
- @CLS
- ECHO.
- ECHO.
- ECHO. ┏━━━━━━━━━━━━━━━━━━━━━━━┓
- ECHO ┃ ┃
- ECHO ┃ 【%SYSPATH%】为硬盘的激活主分区符盘,更改请按【0】 ┃
- ECHO ┃==============================================┃
- ECHO ┃ ┃
- ECHO ┃ [1] 利用[INSTALL.WIM]安装[WINx]系统 ┃
- ECHO ┃ ┃
- ECHO ┃ [2] 添加[BOOT.WIM]项,到[BCD]菜单项 ┃
- ECHO ┃ [3] 添加[WINx.VHD]项,到[BCD]菜单项 ┃
- ECHO ┃ [4] 添加[Grub4DOS]项,到[BCD]菜单项 ┃
- ECHO ┃ [5] 添加[%SYSPATH%\NTLDR]项,到[BCD]菜单项 ┃
- ECHO ┃ ┃
- ECHO ┃ [6] 运行[BCDEDIT],查看[BCD]菜单内容 ┃
- ECHO ┃ [7] 运行[BCDEDIT],删除[BCD]菜单内容 ┃
- ECHO ┃ ┃
- ECHO ┃==============================================┃
- ECHO ┃ ┃
- ECHO ┃ [8] 利用[INSTALL.WIM]生成[WINx.VHD] ┃
- ECHO ┃ ┃
- ECHO ┗━━━━━━━━━━━━━━━━━━━━━━━┛
- ECHO.
- @SET CHOICE=
- @SET /P CHOICE=请输入[数字]选择操作项或 [回车] 退出:
- IF /I "%CHOICE%"=="0" @GOTO SYS
- IF /I "%CHOICE%"=="1" @GOTO VHD
- IF /I "%CHOICE%"=="2" @GOTO BCDWIM
- IF /I "%CHOICE%"=="3" @GOTO VHD
- IF /I "%CHOICE%"=="4" @GOTO G4D
- IF /I "%CHOICE%"=="5" @GOTO BCDNT5
- IF /I "%CHOICE%"=="6" @GOTO BCDMENU
- IF /I "%CHOICE%"=="7" @GOTO BCDDEL
- IF /I "%CHOICE%"=="8" @GOTO VHD
- IF /I "%CHOICE%"=="" @EXIT
- @GOTO MENU
- :SYS
- @CLS
- ECHO.
- ECHO 请输入硬盘的激活主分区符盘,如下面[]里的内容:
- ECHO.
- @SET SYSPATH=
- @SET /P SYSPATH=[C:]
- IF /I "%SYSPATH%"=="" @GOTO SYS
- IF /I NOT EXIST "%SYSPATH%" ECHO. && ECHO 错误:[%SYSPATH%]不存在,请检查一下... && @PAUSE>NUL && @GOTO SYS
- @GOTO MENU
- :BMENU
- @CLS
- ECHO.
- ECHO.
- ECHO. ┏━━━━━━━━━━━━━━━━━━━━━━━┓
- ECHO ┃ ┃
- ECHO ┃ 操作完成,按任意键返回菜单 ┃
- ECHO ┃ ┃
- ECHO ┗━━━━━━━━━━━━━━━━━━━━━━━┛
- ECHO.
- @PAUSE>NUL
- @GOTO MENU
- :VHD
- @CLS
- ECHO.
- ECHO.
- ECHO. ┏━━━━━━━━━━━━━━━━━━━━━━━┓
- ECHO ┃ ┃
- ECHO ┃ [1] 利用 Windows 10 LTSB X64 企业版 [WIM] ┃
- ECHO ┃ ┃
- ECHO ┃ [2] 利用 Windows 10 LTSB X86 企业版 [WIM] ┃
- ECHO ┃ ┃
- ECHO ┃==============================================┃
- ECHO ┃ ┃
- ECHO ┃ [3] 利用 Windows 10 X64 企业版 [WIM] ┃
- ECHO ┃ ┃
- ECHO ┃ [4] 利用 Windows 10 X86 企业版 [WIM] ┃
- ECHO ┃ ┃
- ECHO ┃==============================================┃
- ECHO ┃ ┃
- ECHO ┃ [5] 利用 Windows 7 X64 企业版 [WIM] ┃
- ECHO ┃ ┃
- ECHO ┃ [6] 利用 Windows 7 X86 企业版 [WIM] ┃
- ECHO ┃ ┃
- ECHO ┗━━━━━━━━━━━━━━━━━━━━━━━┛
- ECHO.
- @SET VHDNAME=
- @SET /P VHDNAME=请输入[数字]选择利用[WIM]系统的版本,输入[R]返回主菜单:
- IF /I "%VHDNAME%"=="" @GOTO VHD
- IF /I "%VHDNAME%"=="R" @GOTO MENU
- IF /I "%VHDNAME%"=="1" (@SET VHDNAME=W10L_X64.VHD) && (@SET LABELNAME=V10L-X64) && (@SET IMAGENAME=Windows 10 Enterprise 2016 LTSB) && (@SET MENUNAME=Microsoft Windows 10 Enterprise 2016 LTSB[W10L_X64.VHD]简体中文版) && (IF /I "%CHOICE%"=="8" @GOTO WIM) && (IF /I "%CHOICE%"=="3" @GOTO BCDVHD) && (IF /I "%CHOICE%"=="1" @SET MENUNAME=Microsoft Windows 10 Enterprise 2016 LTSB X64 简体中文版 && @GOTO BWIN)
- IF /I "%VHDNAME%"=="2" (@SET VHDNAME=W10L_X86.VHD) && (@SET LABELNAME=V10L-X86) && (@SET IMAGENAME=Windows 10 Enterprise 2016 LTSB) && (@SET MENUNAME=Microsoft Windows 10 Enterprise 2016 LTSB[W10L_X86.VHD]简体中文版) && (IF /I "%CHOICE%"=="8" @GOTO WIM) && (IF /I "%CHOICE%"=="3" @GOTO BCDVHD) && (IF /I "%CHOICE%"=="1" @SET MENUNAME=Microsoft Windows 10 Enterprise 2016 LTSB X86 简体中文版 && @GOTO BWIN)
- IF /I "%VHDNAME%"=="3" (@SET VHDNAME=W10_X64.VHD) && (@SET LABELNAME=VW10-X64) && (@SET IMAGENAME=Windows 10 Enterprise) && (@SET MENUNAME=Microsoft Windows 10 Enterprise[W10_X64.VHD]简体中文版) && (IF /I "%CHOICE%"=="8" @GOTO WIM) && (IF /I "%CHOICE%"=="3" @GOTO BCDVHD) && (IF /I "%CHOICE%"=="1" @SET MENUNAME=Microsoft Windows 10 Enterprise X64 简体中文版 && @GOTO BWIN)
- IF /I "%VHDNAME%"=="4" (@SET VHDNAME=W10_X86.VHD) && (@SET LABELNAME=VW10-X86) && (@SET IMAGENAME=Windows 10 Enterprise) && (@SET MENUNAME=Microsoft Windows 10 Enterprise[W10_X86.VHD]简体中文版) && (IF /I "%CHOICE%"=="8" @GOTO WIM) && (IF /I "%CHOICE%"=="3" @GOTO BCDVHD) && (IF /I "%CHOICE%"=="1" @SET MENUNAME=Microsoft Windows 10 Enterprise X86 简体中文版 && @GOTO BWIN)
- IF /I "%VHDNAME%"=="5" (@SET VHDNAME=WIN7_X64.VHD) && (@SET LABELNAME=VW7-X64) && (@SET IMAGENAME=Windows 7 ENTERPRISE) && (@SET MENUNAME=Microsoft Windows 7 Enterprise[WIN7_X64.VHD]简体中文版) && (IF /I "%CHOICE%"=="8" @GOTO WIM) && (IF /I "%CHOICE%"=="3" @GOTO BCDVHD) && (IF /I "%CHOICE%"=="1" @SET MENUNAME==Microsoft Windows 7 Enterprise X64 简体中文版 && @GOTO BWIN)
- IF /I "%VHDNAME%"=="6" (@SET VHDNAME=WIN7_X86.VHD) && (@SET LABELNAME=VW7-X86) && (@SET IMAGENAME=Windows 7 ENTERPRISE) && (@SET MENUNAME=Microsoft Windows 7 Enterprise[WIN7_X86.VHD]简体中文版) && (IF /I "%CHOICE%"=="8" @GOTO WIM) && (IF /I "%CHOICE%"=="3" @GOTO BCDVHD) && (IF /I "%CHOICE%"=="1" @SET MENUNAME==Microsoft Windows 7 Enterprise X86 简体中文版 && @GOTO BWIN)
- @GOTO VHD
- :G4D
- @CLS
- ECHO.
- ECHO 请输入[Grub4DOS.MBR]的文件名,如下面[]里的内容,输入[R]返回主菜单:
- ECHO.
- @SET MBRNAME=
- @SET /P MBRNAME=[PELDR.MBR]
- IF /I "%MBRNAME%"=="" @GOTO G4D
- IF /I "%MBRNAME%"=="R" @GOTO MENU
- ECHO.
- ECHO 请输入[Grub4DOS.MBR]所在的盘符,如下面[]里的内容,输入[R]返回主菜单:
- ECHO.
- @SET MBRPATH=
- @SET /P MBRPATH=[C:]
- IF /I "%MBRPATH%"=="" @GOTO G4D
- IF /I "%MBRPATH%"=="R" @GOTO MENU
- IF /I NOT EXIST "%MBRPATH%\%MBRNAME%" ECHO. && ECHO 错误:[%MBRPATH%\%MBRNAME%]不存在,请检查一下... && @PAUSE>NUL && @GOTO G4D
- @GOTO BCDG4D
- :BCD
- @CLS
- IF /I NOT EXIST "%~DP0BOOTSECT.EXE" ECHO. && ECHO 错误:[%~DP0BOOTSECT.EXE]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- IF /I EXIST "%SYSPATH%\BOOTMGR" @DEL /F /A /Q "\\?\%SYSPATH%\BOOTMGR" >NUL
- @ATTRIB -R -A -S -H "%~DP0BOOTMGR" >NUL
- @COPY /Y /V "%~DP0BOOTMGR" "%SYSPATH%" >NUL
- @ATTRIB +R +A +S +H "%SYSPATH%\BOOTMGR" >NUL
- BOOTSECT.EXE /NT60 "%SYSPATH%" /FORCE /MBR >NUL
- IF /I NOT EXIST "%SYSPATH%\BOOT" @MD "%SYSPATH%\BOOT" >NUL
- IF /I NOT EXIST "%SYSPATH%\BOOT\FONTS" @MD "%SYSPATH%\BOOT\FONTS" >NUL
- @COPY /Y /V "%~DP0BOOTVHD.DLL" "%SYSPATH%\BOOT\BOOTVHD.DLL" >NUL
- @COPY /Y /V "%~DP0WGL4_BOOT.TTF" "%SYSPATH%\BOOT\FONTS\WGL4_BOOT.TTF" >NUL
- @COPY /Y /V "%~DP0CHS_BOOT.TTF" "%SYSPATH%\BOOT\FONTS\CHS_BOOT.TTF" >NUL
- IF /I NOT EXIST "%SYSPATH%\BOOT\zh-CN" @MD "%SYSPATH%\BOOT\zh-CN" >NUL
- @COPY /Y /V "%~DP0BOOTMGR.EXE.MUI" "%SYSPATH%\BOOT\zh-CN\BOOTMGR.EXE.MUI" >NUL
- @ATTRIB -R +A +S +H "%SYSPATH%\BOOT" >NUL
- BCDEDIT.EXE /CREATESTORE "%SYSPATH%\BOOT\BCD" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /CREATE {BOOTMGR} >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET {BOOTMGR} LOCALE "zh-CN" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET {BOOTMGR} TIMEOUT "3" >NUL
- @REG.EXE LOAD "HKLM\TEMP_LOAD_BCD" "%SYSPATH%\BOOT\BCD" >NUL
- @REG.EXE ADD "HKLM\TEMP_LOAD_BCD\Description" /f /v "SYSTEM" /t REG_DWORD /d "1" >NUL
- @REG.EXE ADD "HKLM\TEMP_LOAD_BCD\Description" /f /v "TreatAsSystem" /t REG_DWORD /d "1" >NUL
- @REG.EXE UNLOAD "HKLM\TEMP_LOAD_BCD" >NUL
- IF /I "%CHOICE%"=="2" @GOTO BCDWIM
- IF /I "%CHOICE%"=="3" @GOTO BCDVHD
- IF /I "%CHOICE%"=="4" @GOTO BCDG4D
- IF /I "%CHOICE%"=="5" @GOTO BCDNT5
- @GOTO MENU
- :WIM
- @CLS
- IF /I EXIST "%~DP0%VHDNAME%" ECHO. && ECHO 警告:[%~DP0%VHDNAME%]已存在,请检查一下... && @PAUSE>NUL && @GOTO VHD
- IF /I NOT EXIST "%WINDIR%\SYSTEM32\DISKPART.EXE" ECHO. && ECHO 错误:[DISKPART.EXE]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- IF /I NOT EXIST "%~DP0IMAGEX.EXE" ECHO. && ECHO 错误:[%~DP0IMAGEX.EXE]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- @SET WIMNAME=
- FOR %%C IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO (IF /I EXIST "%%C:\SOURCES\INSTALL.WIM" @SET WIMNAME=%%C:\SOURCES\INSTALL.WIM)
- IF /I "%WIMNAME%"=="" (ECHO. && ECHO 错误:[X:\SOURCES\INSTALL.WIM]文件不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU)
- @GOTO BVHD
- :BVHD
- @CLS
- ECHO.
- ECHO.
- ECHO. ┏━━━━━━━━━━━━━━━━━━━━━━━┓
- ECHO ┃ ┃
- ECHO ┃ 请不要关闭窗口,后台正在处理中...... ┃
- ECHO ┃ ┃
- ECHO ┗━━━━━━━━━━━━━━━━━━━━━━━┛
- ECHO.
- ECHO 查看处理进度,请打开文件:%~DP0%VHDNAME%.TXT
- ECHO.
- @ECHO CREATE VDISK FILE="%~DP0%VHDNAME%" MAXIMUM=65539 TYPE=EXPANDABLE>"%TEMP%\DISKPART[ATTACH].TXT"
- @ECHO SELECT VDISK FILE="%~DP0%VHDNAME%">>"%TEMP%\DISKPART[ATTACH].TXT"
- @ECHO ATTACH VDISK>>"%TEMP%\DISKPART[ATTACH].TXT"
- @ECHO CREATE PARTITION PRIMARY ALIGN=512>>"%TEMP%\DISKPART[ATTACH].TXT"
- @ECHO ACTIVE>>"%TEMP%\DISKPART[ATTACH].TXT"
- @ECHO ASSIGN LETTER=V>>"%TEMP%\DISKPART[ATTACH].TXT"
- @ECHO FORMAT FS=NTFS UNIT=4096 LABEL=%LABELNAME%>>"%TEMP%\DISKPART[ATTACH].TXT"
- @ECHO EXIT>>"%TEMP%\DISKPART[ATTACH].TXT"
- IF /I NOT EXIST "%TEMP%\DISKPART[ATTACH].TXT" ECHO. && ECHO 错误:[配置文件]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- DISKPART.EXE /S "%TEMP%\DISKPART[ATTACH].TXT">"%~DP0%VHDNAME%.TXT"
- IMAGEX.EXE /APPLY "%WIMNAME%" "%IMAGENAME%" "V:">>"%~DP0%VHDNAME%.TXT"
- @ECHO SELECT VDISK FILE="%~DP0%VHDNAME%">"%TEMP%\DISKPART[DETACH].TXT"
- @ECHO DETACH VDISK>>"%TEMP%\DISKPART[DETACH].TXT"
- @ECHO EXIT>>"%TEMP%\DISKPART[DETACH].TXT"
- IF /I NOT EXIST "%TEMP%\DISKPART[DETACH].TXT" ECHO. && ECHO 错误:[配置文件]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- DISKPART.EXE /S "%TEMP%\DISKPART[DETACH].TXT">>"%~DP0%VHDNAME%.TXT"
- FOR /L %%I IN (1,1,21000) DO (IF /I EXIST "%~DP0%VHDNAME%" @REN "%~DP0%VHDNAME%" "%VHDNAME%_O">>"%~DP0%VHDNAME%.TXT")
- @ECHO CREATE VDISK FILE="%~DP0%VHDNAME%" PARENT="%~DP0%VHDNAME%_O">"%TEMP%\DISKPART[PARENT].TXT"
- @ECHO EXIT>>"%TEMP%\DISKPART[PARENT].TXT"
- IF /I NOT EXIST "%TEMP%\DISKPART[PARENT].TXT" ECHO. && ECHO 错误:[配置文件]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- IF /I EXIST "%~DP0%VHDNAME%_O" DISKPART.EXE /S "%TEMP%\DISKPART[PARENT].TXT">>"%~DP0%VHDNAME%.TXT"
- @COPY /Y /V "%~DP0%VHDNAME%" "%~DP0%VHDNAME%_DD"
- @START "" "%~DP0%VHDNAME%.TXT"
- @DEL /F /A /Q "\\?\%TEMP%\DISKPART[ATTACH].TXT" >NUL
- @DEL /F /A /Q "\\?\%TEMP%\DISKPART[DETACH].TXT" >NUL
- @DEL /F /A /Q "\\?\%TEMP%\DISKPART[PARENT].TXT" >NUL
- @GOTO BMENU
- :BCDWIM
- @CLS
- IF /I NOT EXIST "%SYSPATH%\BOOT\BOOT.WIM" ECHO. && ECHO 警告:[%SYSPATH%\BOOT\BOOT.WIM]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- IF /I NOT EXIST "%SYSPATH%\BOOT\BOOT.SDI" ECHO. && ECHO 警告:[%SYSPATH%\BOOT\BOOT.SDI]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- IF /I NOT EXIST "%~DP0BCDEDIT.EXE" ECHO. && ECHO 错误:[%~DP0BCDEDIT.EXE]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- IF /I NOT EXIST "%SYSPATH%\BOOT\BCD" @GOTO BCD
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /ENUM ACTIVE >"%TEMP%\BCDTEMP.TXT"
- @TYPE "%TEMP%\BCDTEMP.TXT" | FIND /I "\BOOT\BOOT.WIM" >NUL && ECHO. && ECHO 错误:[%SYSPATH%\BOOT\BOOT.WIM]菜单已存在,请检查一下... && @DEL /F /A /Q "\\?\%TEMP%\BCDTEMP.TXT" >NUL && @PAUSE>NUL && @GOTO MENU
- @SET VID=
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /CREATE /D "Boot from WIM" /APPLICATION OSLOADER >"%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 /STORE "%SYSPATH%\BOOT\BCD" /CREATE {RAMDISKOPTIONS} >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET {RAMDISKOPTIONS} RAMDISKSDIDEVICE "PARTITION=%SYSPATH%" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET {RAMDISKOPTIONS} RAMDISKSDIPATH "\BOOT\BOOT.SDI" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% DEVICE "RAMDISK=[%SYSPATH%]\BOOT\BOOT.WIM,{RAMDISKOPTIONS}" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% OSDEVICE "RAMDISK=[%SYSPATH%]\BOOT\BOOT.WIM,{RAMDISKOPTIONS}" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% PATH "\WINDOWS\SYSTEM32\WINLOAD.EXE" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% SYSTEMROOT "\WINDOWS" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% BOOTMENUPOLICY LEGACY >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% NX "OptIn" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% PAE "ForceEnable" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% DETECTHAL "YES" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% WINPE "YES" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% LOCALE "zh-CN" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET {BOOTMGR} DISPLAYORDER %VID% /ADDLAST >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET {BOOTMGR} TIMEOUT "3" >NUL
- @DEL /F /A /Q "\\?\%TEMP%\VID.TXT" >NUL
- @GOTO BMENU
- :BCDVHD
- @CLS
- IF /I NOT EXIST "%~DP0%VHDNAME%" ECHO. && ECHO 警告:[%~DP0%VHDNAME%]不存在,请检查一下... && @PAUSE>NUL && @GOTO VHD
- IF /I NOT EXIST "%~DP0BCDEDIT.EXE" ECHO. && ECHO 错误:[%~DP0BCDEDIT.EXE]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- IF /I NOT EXIST "%SYSPATH%\BOOT\BCD" @GOTO BCD
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /ENUM ACTIVE >"%TEMP%\BCDTEMP.TXT"
- @TYPE "%TEMP%\BCDTEMP.TXT" | FIND /I "%MENUNAME%" >NUL && ECHO. && ECHO 错误:[%MENUNAME%]菜单已存在,请检查一下... && @DEL /F /A /Q "\\?\%TEMP%\BCDTEMP.TXT" >NUL && @PAUSE>NUL && @GOTO VHD
- @SET VID=
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /CREATE /D "%MENUNAME%" /APPLICATION OSLOADER >"%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 /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% DEVICE "VHD=[%~D0]%~P0%VHDNAME%" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% OSDEVICE "VHD=[%~D0]%~P0%VHDNAME%" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% PATH "\WINDOWS\SYSTEM32\WINLOAD.EXE" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% SYSTEMROOT "\WINDOWS" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% BOOTMENUPOLICY LEGACY >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% NX "OptIn" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% PAE "ForceEnable" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% DETECTHAL "YES" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% WINPE "NO" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% LOCALE "zh-CN" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET {BOOTMGR} DISPLAYORDER %VID% /ADDLAST >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET {BOOTMGR} TIMEOUT "3" >NUL
- @DEL /F /A /Q "\\?\%TEMP%\VID.TXT" >NUL
- @GOTO BMENU
- :BCDG4D
- @CLS
- IF /I NOT EXIST "%~DP0BCDEDIT.EXE" ECHO. && ECHO 错误:[%~DP0BCDEDIT.EXE]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- IF /I NOT EXIST "%SYSPATH%\BOOT\BCD" @GOTO BCD
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /ENUM ACTIVE >"%TEMP%\BCDTEMP.TXT"
- @TYPE "%TEMP%\BCDTEMP.TXT" | FIND /I "\%MBRNAME%" >NUL && ECHO. && ECHO 错误:[%MBRPATH%\%MBRNAME%]菜单已存在,请检查一下... && @DEL /F /A /Q "\\?\%TEMP%\BCDTEMP.TXT" >NUL && @PAUSE>NUL && @GOTO G4D
- @SET VID=
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /CREATE /D "Boot from G4D" /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 /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% DEVICE "PARTITION=%MBRPATH%" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET %VID% PATH "\%MBRNAME%" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET {BOOTMGR} DISPLAYORDER %VID% /ADDLAST >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET {BOOTMGR} TIMEOUT "3" >NUL
- @DEL /F /A /Q "\\?\%TEMP%\VID.TXT" >NUL
- @GOTO BMENU
- :BCDNT5
- @CLS
- IF /I NOT EXIST "%~DP0BCDEDIT.EXE" ECHO. && ECHO 错误:[%~DP0BCDEDIT.EXE]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- IF /I NOT EXIST "%SYSPATH%\NTLDR" ECHO. && ECHO 错误:[%SYSPATH%\NTLDR]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- IF /I NOT EXIST "%SYSPATH%\BOOT\BCD" @GOTO BCD
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /ENUM ACTIVE >"%TEMP%\BCDTEMP.TXT"
- @TYPE "%TEMP%\BCDTEMP.TXT" | FIND /I "\NTLDR" >NUL && ECHO. && ECHO 错误:[%SYSPATH%\NTLDR]菜单已存在,请检查一下... && @DEL /F /A /Q "\\?\%TEMP%\BCDTEMP.TXT" >NUL && @PAUSE>NUL && @GOTO MENU
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /CREATE {NTLDR} /D "Microsoft Windows XP Professional" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET {NTLDR} DEVICE "PARTITION=%SYSPATH%" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET {NTLDR} PATH "\NTLDR" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET {BOOTMGR} DISPLAYORDER {NTLDR} /ADDLAST >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET {BOOTMGR} TIMEOUT "3" >NUL
- @GOTO BMENU
- :BCDMENU
- @CLS
- IF /I NOT EXIST "%~DP0BCDEDIT.EXE" ECHO. && ECHO 错误:[%~DP0BCDEDIT.EXE]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- IF /I NOT EXIST "%SYSPATH%\BOOT\BCD" ECHO. && ECHO 错误:[%SYSPATH%\BOOT\BCD]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /ENUM ACTIVE >"%~DP0BCD_MENU.TXT"
- @START "" "%~DP0BCD_MENU.TXT"
- @GOTO MENU
- :BCDDEL
- @CLS
- IF /I NOT EXIST "%~DP0BCDEDIT.EXE" ECHO. && ECHO 错误:[%~DP0BCDEDIT.EXE]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- IF /I NOT EXIST "%SYSPATH%\BOOT\BCD" ECHO. && ECHO 错误:[%SYSPATH%\BOOT\BCD]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- ECHO.
- ECHO 请输入删除项在[BCD]中[IDENTIFIER]的名,如下面[]里的内容,输入[R]返回主菜单:
- ECHO.
- @SET BCDDELNAME=
- @SET /P BCDDELNAME=[{NTLDR}]或[{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}]
- IF /I "%BCDDELNAME%"=="" @GOTO BCDDEL
- IF /I "%BCDDELNAME%"=="R" @GOTO MENU
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /ENUM ACTIVE >"%TEMP%\BCDTEMP.TXT"
- @TYPE "%TEMP%\BCDTEMP.TXT" | FIND /I "%BCDDELNAME%" >NUL && BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /DELETE "%BCDDELNAME%" >NUL && @GOTO BMENU
- ECHO.
- ECHO 错误:["%BCDDELNAME%"]菜单不存在,请检查一下...
- ECHO.
- @DEL /F /A /Q "\\?\%TEMP%\BCDTEMP.TXT" >NUL && @PAUSE>NUL
- @GOTO BCDDEL
- :BWIN
- @CLS
- ECHO.
- IF /I NOT EXIST "%SYSPATH%" ECHO. && ECHO 错误:[%SYSPATH%]不存在,请检查一下... && @PAUSE>NUL && @GOTO SYS
- @CLS
- ECHO.
- @SET GOYN=
- @SET /P GOYN=现在已经选择了【%SYSPATH%】为硬盘的激活主分区符盘,是否安装系统到【%SYSPATH%】盘?【Y】
- IF /I NOT "%GOYN%"=="Y" @GOTO MENU
- @CLS
- ECHO.
- IF /I NOT EXIST "%~DP0BOOTSECT.EXE" ECHO. && ECHO 错误:[%~DP0BOOTSECT.EXE]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- IF /I NOT EXIST "%~DP0IMAGEX.EXE" ECHO. && ECHO 错误:[%~DP0IMAGEX.EXE]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- IF /I NOT EXIST "%~DP0BCDBOOT.EXE" ECHO. && ECHO 错误:[%~DP0BCDBOOT.EXE]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- IF /I NOT EXIST "%~DP0BCDEDIT.EXE" ECHO. && ECHO 错误:[%~DP0BCDEDIT.EXE]不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU
- BOOTSECT.EXE /NT60 "%SYSPATH%" /FORCE /MBR >NUL
- @SET WIMNAME=
- FOR %%C IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO (IF /I EXIST "%%C:\SOURCES\INSTALL.WIM" @SET WIMNAME=%%C:\SOURCES\INSTALL.WIM)
- IF /I "%WIMNAME%"=="" (ECHO. && ECHO 错误:[X:\SOURCES\INSTALL.WIM]文件不存在,请检查一下... && @PAUSE>NUL && @GOTO MENU)
- IMAGEX.EXE /APPLY "%WIMNAME%" "%IMAGENAME%" "%SYSPATH%"
- BCDBOOT.EXE "%SYSPATH%\Windows" /S "%SYSPATH%" /L "zh-CN" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET {DEFAULT} DESCRIPTION "%MENUNAME%" >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET {DEFAULT} BOOTMENUPOLICY LEGACY >NUL
- BCDEDIT.EXE /STORE "%SYSPATH%\BOOT\BCD" /SET {BOOTMGR} TIMEOUT "3" >NUL
- @GOTO BMENU
复制代码
|
|