以前保存的 你改改吧 @echo off pushd "%~dp0" echo.&echo. if exist bcd_tmp del bcd_tmp bcdedit >temp_bcd.txt 2>nul type temp_bcd.txt | find /i "winload.efi" &&(set "winload=winload.efi")||(set winload=winload.exe) type temp_bcd.txt | find "{ramdiskoptions}" >nul IF ERRORLEVEL 1 goto ramd cls&echo.&echo. :start for /f "delims={,} tokens=2" %%a in ('bcdedit -create /d "Windows PE" -application osloader ') do set ID={%%a} bcdedit %bcddir% -set %ID% device ramdisk="[boot]\Sources\WinPE.WIM,{ramdiskoptions}" bcdedit %bcddir% -set %ID% osdevice ramdisk="[boot]\Sources\WinPE.WIM,{ramdiskoptions}" bcdedit %bcddir% -set %ID% path \windows\system32\boot\%winload% bcdedit %bcddir% -set %ID% locale zh-CN bcdedit %bcddir% -set %ID% systemroot \windows bcdedit %bcddir% -set %ID% detecthal no bcdedit %bcddir% -set %ID% winpe yes bcdedit %bcddir% -set %ID% testsigning yes bcdedit %bcddir% -set %ID% nointegritychecks yes bcdedit %bcddir% -set %ID% pae forceenable bcdedit %bcddir% -set %ID% bootmenupolicy Legacy bcdedit %bcddir% -displayorder %ID% -addlast goto end :ramd cls&echo.&echo. bcdedit /create {ramdiskoptions} bcdedit /set {ramdiskoptions} ramdisksdidevice "boot" bcdedit /set {ramdiskoptions} ramdisksdipath \efi\boot.sdi goto start :end echo.&echo.&echo Add-Wim to BCD OK !!! &timeout /t 5 &exit