@echo off
Setlocal

::Set path to bcdedit.exe (e.g. C:\Windows\System32\bcdedit.exe)
Set BCDEDIT=%Windir%\System32\bcdedit.exe

::Set path to BCD Store (e.g. C:\boot\BCD)
Set STORE=%1

for /f "tokens=3" %%A in ('%BCDEDIT% /store %STORE% /create /d "GRUB4DOS" /application bootsector') do set guid=%%A
%BCDEDIT% /store %STORE% /set %guid% device boot
%BCDEDIT% /store %STORE% /set %guid% path \grldr.mbr
%BCDEDIT% /store %STORE% /displayorder %guid% /addlast

endlocal
pause
exit