@echo off setlocal set BCDEDIT=%SYSTEMROOT%\system32\bcdedit.exe set BCDSTORE=%~dp0BCD set LABEL="WinPE Flat Boot" :_options cls echo. ECHO BCDSTORE=%BCDSTORE% ECHO LABEL=%LABEL% echo. echo 1] Continue echo 2] ABORT echo. set choice= set /p choice=Select option [1 - 2] and press ENTER. if '%choice%'=='1' goto _continue if '%choice%'=='2' goto _end goto _options :_continue cls IF EXIST %BCDSTORE% del %BCDSTORE% /F Echo Creating store... %BCDEDIT% /createstore %BCDSTORE% echo. Echo Creating bootmgr entry... %BCDEDIT% /store %BCDSTORE% /create {bootmgr} %BCDEDIT% /store %BCDSTORE% /set {bootmgr} description "Boot Manager" %BCDEDIT% /store %BCDSTORE% /set {bootmgr} device boot %BCDEDIT% /store %BCDSTORE% /set {bootmgr} timeout 20 echo. Echo Adding FlatBoot WinPE entry... for /f "tokens=2 delims={}" %%g in ('%BCDEDIT% /store %BCDSTORE% /create /application osloader') do set guid={%%g} %BCDEDIT% /store %BCDSTORE% /set %guid% path \Windows\system32\winload.exe %BCDEDIT% /store %BCDSTORE% /set %guid% device boot %BCDEDIT% /store %BCDSTORE% /set %guid% osdevice boot %BCDEDIT% /store %BCDSTORE% /set %guid% systemroot \Windows %BCDEDIT% /store %BCDSTORE% /set %guid% description %LABEL% %BCDEDIT% /store %BCDSTORE% /set %guid% winpe yes %BCDEDIT% /store %BCDSTORE% /set %guid% detecthal yes %BCDEDIT% /store %BCDSTORE% /displayorder %guid% /addlast echo. pause :_end