|
- @pushd "%~dp0" >nul 2>&1
- @echo off
- ::这里判断了一下当前引导是否 MBR,如果是 那肯定是有 \Windows\system32\winload.exe 这个输出的,如果没有那就GPT 反正目前引导就两种方式。
- :BOOT
- bcdedit >boot.txt
- find "\Windows\system32\winload.exe" boot.txt
- IF %ERRORLEVEL% EQU 0 goto MBR
- IF %ERRORLEVEL% EQU 1 goto GPT
- :MBR
- set id1={%time:~6,2%%time:~9,2%9ae2-251d-4c33-8124-1f8b578d028b}
- set id2={%time:~6,2%%time:~9,2%a46a-0e56-4c0e-8fd2-2602b93a3dd3}
- bcdedit /create %id2% /d "Windows PE" /device
- bcdedit /set %id2% ramdisksdidevice partition=%SystemDrive%
- bcdedit /set %id2% ramdisksdipath "\boot\BOOT.SDI"
- bcdedit /create %id1% /d "Windows PE" /application osloader
- bcdedit /set %id1% device ramdisk="[%SystemDrive%]\boot\boot.wim",%id2%
- bcdedit /set %id1% osdevice ramdisk="[%SystemDrive%]\boot\boot.wim",%id2%
- bcdedit /set %id1% path \Windows\system32\boot\winload.exe
- bcdedit /set %id1% description "Windows PE"
- bcdedit /set %id1% locale zh-CN
- bcdedit /set %id1% inherit {bootloadersettings}
- bcdedit /set %id1% systemroot \windows
- bcdedit /set %id1% detecthal Yes
- bcdedit /set %id1% winpe Yes
- bcdedit /set %id1% ems no
- bcdedit /displayorder %id1% /addlast
- bcdedit /timeout 2
- exit
- :GPT
- set id1={%time:~6,2%%time:~9,2%9ae2-251d-4c33-8124-1f8b578d028b}
- set id2={%time:~6,2%%time:~9,2%a46a-0e56-4c0e-8fd2-2602b93a3dd3}
- bcdedit /create %id2% /d "Windows PE" /device
- bcdedit /set %id2% ramdisksdidevice partition=%SystemDrive%
- bcdedit /set %id2% ramdisksdipath "\boot\BOOT.SDI"
- bcdedit /create %id1% /d "Windows PE" /application osloader
- bcdedit /set %id1% device ramdisk="[%SystemDrive%]\boot\boot.wim",%id2%
- bcdedit /set %id1% osdevice ramdisk="[%SystemDrive%]\boot\boot.wim",%id2%
- bcdedit /set %id1% path \Windows\system32\boot\winload.efi
- bcdedit /set %id1% description "Windows PE"
- bcdedit /set %id1% locale zh-CN
- bcdedit /set %id1% inherit {bootloadersettings}
- bcdedit /set %id1% systemroot \windows
- bcdedit /set %id1% detecthal Yes
- bcdedit /set %id1% winpe Yes
- bcdedit /set %id1% ems no
- bcdedit /displayorder %id1% /addlast
- bcdedit /timeout 2
- attrib +r +s +h c:\boot
- del %0
复制代码 |
|