!BAT
setlocal

set bf=%1
if "%bf%"=="" && set bf=/bootmgr

find --set-root %bf% || echo can't find %bf% && exit 1
set rttmp=%@root%
set bdtmp=%rttmp:~1,3%

if /i %bdtmp%==hd0 goto chainfile
map (%bdtmp%) (hd0)
map (hd0) (%bdtmp%)
map --hook
rootnoverify (hd0)
chainloader (hd0)+1
goto end


:chainfile
#echo %@root%
find --set-root %bf%
chainloader %bf%
goto end


:end
endlocal
exit
