|
set src=%1
if %1.==. set /p src=请将pe的wim文件拖放到本窗口后按回车键:
for %%a in (%src%) do (set NX=%%~nxa)
echo !NX!&pause
for /f "tokens=1*" %%c in ('Dism.exe /Get-ImageInfo /ImageFile:%src% /Index:1') do (
if /i "%%c"=="名称:" (set wim_name=%%d)
)
mountvol R: /S
dir R:\
if not exist R:\Sources md R:\Sources 1>nul 2>nul
copy /y %src% R:\Sources
BCDEdit /enum {ramdiskoptions} /v >nul 2>nul
IF errorlevel 1 (
xcopy /yhie boot.sdi R:\EFI
bcdedit /create {ramdiskoptions} 1>nul 2>nul
bcdedit /set {ramdiskoptions} ramdisksdidevice "boot" 1>nul 2>nul
bcdedit /set {ramdiskoptions} ramdisksdipath \EFI\boot.sdi 1>nul 2>nul
)
mountvol R: /D
for /f "delims={,} tokens=2" %%a in ('bcdedit -create /d "%wim_name%" -application osloader ') do set ID={%%a}
bcdedit /set %ID% device ramdisk="[boot]\Sources\%NX%,{ramdiskoptions}"
bcdedit /set %ID% osdevice ramdisk="[boot]\Sources\%NX%,{ramdiskoptions}"
bcdedit /set %ID% path \windows\system32\boot\winload.efi
bcdedit /set %ID% locale zh-CN 1>nul 2>nul
bcdedit /set %ID% systemroot \windows 1>nul 2>nul
bcdedit /set %ID% detecthal yes 1>nul 2>nul
bcdedit /set %ID% winpe yes 1>nul 2>nul
bcdedit /set %ID% bootmenupolicy Legacy 1>nul 2>nul
bcdedit /displayorder %ID% -addlast 1>nul 2>nul
echo !src! OK
Pause>nul
exit |
|