|
这是我的PE安装.BAT
@echo off
if /I "%SystemRoot%"=="X:\Windows" goto stPE
SET BCDD=bcdedit
goto getadmin
:stPE
PECMD EXEC =*%ProgramFiles%\FixLegacyUefi\MountESP64.EXE
set boos=UEFI
color 0C
cls
echo *******************************************************************************
echo ** **
echo ** 大漠孤鹰_Win10_PE_X64 空盘UEFI安装向导 **
echo ** **
echo *******************************************************************************
echo. 如果已经安装了系统,建议在桌面系统运行“%~n0”
echo.-------------------------------------------------------------------------------
echo.
SET /P PEEPS=输入预放置引导文件的ESP分区盘符,请输入单字母(例如 F):
set PEEPS=%PEEPS%:
SET BCDPH=%PEEPS%\efi\microsoft\boot\bcd
SET BCDD=bcdedit /store %BCDPH%
cls
echo *******************************************************************************
echo ** **
echo ** 大漠孤鹰_Win10_PE_X64 空盘UEFI安装向导 **
echo ** **
echo *******************************************************************************
echo.请先手动复制 %~dp0\efi 文件夹到%PEEPS%
echo.
echo.按任意键将弹出 %~dp0盘 窗口
pause >nul
start %PEEPS%&&start %~dp0
:start
set Ph=WEPE
set WimName=WEPE64.WIM
set SdiName=WEPE.SDI
set wzName=PE外置程序
set pename=Win10PE_x64_%boos%
if /I "%boos%"=="UEFI" set efiPh=\windows\system32\boot\winload.efi
if /I "%boos%"=="BOOS" set efiPh=\windows\system32\boot\winload.exe
goto GUID1
:open
set wzdvr=
set setdvr=
set tag=
color 0a
cls
echo *******************************************************************************
echo ** **
echo ** 大漠孤鹰_Win10_PE_X64 安装向导(自动识别UEFI与BOOS) **
echo ** **
echo *******************************************************************************
echo.
echo. 您的系统为“%boos%”启动
echo.
echo. 请确认:安装文件“%~n0”与PE源文件位于同一目录“%~dp0”
echo.
echo.-------------------------------------------------------------------------------
echo.
echo.请选择:安装此PE到哪个分区?
echo.
SET /P setdvr=请输入单字母(例如:D)如果直接按回车,将自动安装到C:盘:
if /I "%setdvr%"=="" set setdvr=C
set setdvr=%setdvr%:
color 0b
cls
echo *******************************************************************************
echo ** **
echo ** 大漠孤鹰_Win10_PE_X64 安装向导(自动识别UEFI与BOOS) **
echo ** **
echo *******************************************************************************
echo.
echo.请选择:安装“%wzName%”到哪个分区?
echo.
SET /P wzdvr=请输入单字母(例如:D)如果直接按回车,将自动安装到C:盘:
if /I "%wzdvr%"=="" set wzdvr=C
set wzdvr=%wzdvr%:
color 0d
cls
echo *******************************************************************************
echo ** **
echo ** 大漠孤鹰_Win10_PE_X64 安装向导(自动识别UEFI与BOOS) **
echo ** **
echo *******************************************************************************
echo.
echo. 将创建“%boos%”启动项“%pename%”到启动菜单......
echo.
echo. 将复制“%wzName%”文件夹到 %wzdvr%\%wzName%......
echo.
echo. 将复制 主程序文件到到 %setdvr%\%Ph%......
echo.
echo.-------------------------------------------------------------------------------
SET /P tag=按任意键开始安装,按数字 1 则返回主菜单重新设置:
if /I "%tag%"=="1" goto open
color 0f
cls
MD %setdvr%\%Ph%
MD %wzdvr%\%wzName%
COPY "%~dp0%Ph%\%SdiName%" %setdvr%\%Ph%\%SdiName%
COPY "%~dp0%Ph%\%WimName%" %setdvr%\%Ph%\%WimName%
XCOPY "%~dp0%wzName%\*" %wzdvr%\%wzName% /s /e
cls
%BCDD% /create %RAMDISK_OPTIONS% /d "%pename%" /device
%BCDD% /set %RAMDISK_OPTIONS% ramdisksdidevice partition=%setdvr%
%BCDD% /set %RAMDISK_OPTIONS% ramdisksdipath \%Ph%\%SdiName%
%BCDD% /create %WINPE_GUID% /d "%pename%" /application OSLOADER
%BCDD% /set %WINPE_GUID% device ramdisk=[%setdvr%]\%Ph%\%WimName%,%RAMDISK_OPTIONS%
%BCDD% /set %WINPE_GUID% path %efiPh%
%BCDD% /set %WINPE_GUID% osdevice ramdisk=[%setdvr%]\%Ph%\%WimName%,%RAMDISK_OPTIONS%
%BCDD% /set %WINPE_GUID% systemroot \windows
%BCDD% /set %WINPE_GUID% detecthal yes
%BCDD% /set %WINPE_GUID% nx optin
%BCDD% /set %WINPE_GUID% pae ForceEnable
%BCDD% /set %WINPE_GUID% winpe yes
%BCDD% /set %WINPE_GUID% locale "zh-CN"
%BCDD% /displayorder %WINPE_GUID% /addlast
%BCDD% /timeout 3
color 0e
echo *******************************************************************************
echo ** **
echo ** 大漠孤鹰_Win10_PE_X64 安装向导(自动识别UEFI与BOOS) **
echo ** **
echo *******************************************************************************
echo.
echo.安装完成,按任意键将弹出BOOTICE引导项窗口,请删除无用的引导项。
echo.
pause >nul
if /I "%SystemRoot%"=="X:\Windows" "%ProgramFiles%\Others\BOOTICE.exe" /edit_bcd /easymode /file=%BCDPH%&&exit
BOOTICEx86_v1.3.4.0.exe /edit_bcd /easymode
exit
:getadmin
%1 mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&&exit /b
pushd "%CD%"
CD /D "%~dp0"
bcdedit>"%temp%\temp.txt"
@findstr winload.efi "%temp%\temp.txt"&&set boos=UEFI||set boos=BOOS
del "%temp%\temp.txt" /q
goto start
:GUID1
for %%i in ("0=A" "1=B" "2=C" "3=D" "4=E" "5=F")do set "x1%%~i"
setlocal enabledelayedexpansion
set "guid="
for /l %%i in (1,1,32)do (
set/a "n=!random!&15"
if !n! gtr 9 call set "n=%%x!n!%%"
set "guid=!guid!!n!")
set "guid=%guid:~,8%-%guid:~8,4%-%guid:~12,4%-%guid:~16,4%-%guid:~-12%"
if /I "%no%"=="1" goto GUID2
set RAMDISK_OPTIONS={%guid%}
set no=1&&goto GUID1
:GUID2
set WINPE_GUID={%guid%}
goto open |
|