|
分享一个批处理:添加pe到硬盘
- @echo off
- title 添加PE到硬盘
- setlocal ENABLEDELAYEDEXPANSION
- if %1.==. (set src=pe\boot.wim) else set src=%1
- set drv=c
- pushd %~dp0
- :do
- cls
- echo.
- echo 即将把 %src% 复制到 %drv%:\pe.wim 并添加引导
- echo.
- echo 1.确认执行 2.修改目标盘符 3.退出
- echo.
- set n=1
- set /p n=请输入选项并回车:
- goto:do%n%
- :do2
- echo.&set /p drv=请输入PE添加到的盘符:
- goto:do
- :do1
- if exist s: mountvol s: /d
- mountvol s: /s && (call :uefi) || call :bios
- call :chksdi
- call :chkwim
- call :bcd
- echo 请按任意键结束...
- pause>nul
- exit
- :uefi
- set bd=s
- set sdi=\EFI\boot.sdi
- exit /b
- :bios
- set bd=c
- set sdi=\boot\boot.sdi
- exit /b
- :chksdi
- if not exist %bd%:%sdi% (
- if exist C:\Windows\Boot\DVD\EFI\boot.sdi (
- set sdi1=C:\Windows\Boot\DVD\EFI\boot.sdi
- ) else (
- if exist pe\boot.sdi (
- set sdi1=pe\boot.sdi
- ) else (
- echo.&set /p sdi1=请将boot.sdi文件拖放到本窗口后按回车键:
- )
- )
- copy !sdi1! %bd%:%sdi%
- )
- exit /b
- :chkwim
- if not exist %drv%:\pe.wim (
- if exist %src% (
- set wim=%src%
- ) else (
- echo.&set /p wim=请将pe的wim文件拖放到本窗口后按回车键:
- )
- echo 复制 !wim! 到 %drv%:\pe.wim
- copy !wim! %drv%:\pe.wim
- )
- exit /b
- :bcd
- if not exist %drv%:\pe.wim goto:error
- if not exist %bd%:%sdi% goto:error
- echo 添加菜单引导项
- set desc="Win PE"
- set wim=[%drv%:]\pe.wim
- for /f "tokens=2 delims={}" %%a in ('bcdedit /create /application osloader') do set id={%%a}
- bcdedit /set %id% description %desc%
- bcdedit /set %id% device ramdisk="%wim%,{ramdiskoptions}"
- bcdedit /set %id% osdevice ramdisk="%wim%,{ramdiskoptions}"
- bcdedit /set %id% systemroot \Windows
- bcdedit /set %id% detecthal 1
- bcdedit /set %id% winpe 1
- bcdedit /displayorder %id% /addlast
- bcdedit /timeout 3
- bcdedit /set {bootmgr} displaybootmenu 1
- bcdedit /set {bootmgr} nointegritychecks 1
- bcdedit /create {ramdiskoptions}
- bcdedit /set {ramdiskoptions} ramdisksdidevice boot
- bcdedit /set {ramdiskoptions} ramdisksdipath %sdi%
- exit /b
- :error
- ::cls
- echo.
- echo 复制文件失败,请手动复制文件 pe.wim 和 boot.sdi 到 %drv%:\pe.wim 和 %bd%:%sdi% 后按任意键继续...
- pause>nul
- goto:bcd
复制代码
添加PE到硬盘.7z
(1.05 KB, 下载次数: 128)
|
|