@echo off setlocal :: Do not use spaces in paths and do :: NOT wrap in quotes set BCDEDIT=%SYSTEMROOT%\system32\bcdedit.exe set BCDSTORE="%~dp0BCD" ::___________________________________ Echo Creating BCD Store... %BCDEDIT% /createstore %BCDSTORE% Echo Adding {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 Creating ramdisksdidevice entry... for /f "tokens=2 delims={}" %%g in ('%BCDEDIT% /store %BCDSTORE% /create /device') do set ramdisk={%%g} %BCDEDIT% /store %BCDSTORE% /set %ramdisk% ramdisksdidevice boot %BCDEDIT% /store %BCDSTORE% /set %ramdisk% ramdisksdipath \boot\boot.sdi Echo Adding RAM Boot WinFE entry... for /f "tokens=2 delims={}" %%g in ('%BCDEDIT% /store %BCDSTORE% /create /application osloader') do set GUID={%%g} %BCDEDIT% /store %BCDSTORE% /set %GUID% systemroot \Windows %BCDEDIT% /store %BCDSTORE% /set %GUID% detecthal Yes %BCDEDIT% /store %BCDSTORE% /set %GUID% winpe Yes %BCDEDIT% /store %BCDSTORE% /set %GUID% osdevice ramdisk=[boot]\sources\x86.wim,%ramdisk% %BCDEDIT% /store %BCDSTORE% /set %GUID% device ramdisk=[boot]\sources\x86.wim,%ramdisk% %BCDEDIT% /store %BCDSTORE% /set %GUID% path \windows\system32\winload.exe %BCDEDIT% /store %BCDSTORE% /set %GUID% description "32-bit Windows FE RAMBoot (BIOS)" %BCDEDIT% /store %BCDSTORE% /displayorder %guid% /addlast Echo Creating ramdisksdidevice entry... for /f "tokens=2 delims={}" %%g in ('%BCDEDIT% /store %BCDSTORE% /create /device') do set ramdisk={%%g} %BCDEDIT% /store %BCDSTORE% /set %ramdisk% ramdisksdidevice boot %BCDEDIT% /store %BCDSTORE% /set %ramdisk% ramdisksdipath \boot\boot.sdi Echo Adding RAM Boot WinFE entry... for /f "tokens=2 delims={}" %%g in ('%BCDEDIT% /store %BCDSTORE% /create /application osloader') do set GUID={%%g} %BCDEDIT% /store %BCDSTORE% /set %GUID% systemroot \Windows %BCDEDIT% /store %BCDSTORE% /set %GUID% detecthal Yes %BCDEDIT% /store %BCDSTORE% /set %GUID% winpe Yes %BCDEDIT% /store %BCDSTORE% /set %GUID% osdevice ramdisk=[boot]\sources\x64.wim,%ramdisk% %BCDEDIT% /store %BCDSTORE% /set %GUID% device ramdisk=[boot]\sources\x64.wim,%ramdisk% %BCDEDIT% /store %BCDSTORE% /set %GUID% path \windows\system32\winload.exe %BCDEDIT% /store %BCDSTORE% /set %GUID% description "64-bit Windows FE RAMBoot (BIOS)" %BCDEDIT% /store %BCDSTORE% /displayorder %guid% /addlast Echo Adding FlatBoot WinFE 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 "Windows FE FLATBoot (BIOS)" %BCDEDIT% /store %BCDSTORE% /set %guid% winpe yes %BCDEDIT% /store %BCDSTORE% /set %guid% detecthal yes %BCDEDIT% /store %BCDSTORE% /displayorder %guid% /addlast echo. endlocal pause