@echo off
set filename=
for /f "delims=" %%i in (rom_enc.txt) do set filename=%%i
echo.
echo BMC firmware image: %filename%
echo.

::set the image selector to use latest image
ipmitool -H %1 -U admin -P %2 -I lanplus raw 0x32 0x8f 0x01 0x04

cd winflash

if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto 64BIT
    
:32BIT
echo Windows x86 Environment
echo.
cd Win32
Yafuflash.exe -vyes -nw -ip %1 -u admin -p %2 -mse 0 -fb -pc -ignore-existing-overrides ..\..\%filename%
goto END

:64BIT
echo Windows x64 Environment
echo.
cd Win64
Yafuflash.exe -vyes -nw -ip %1 -u admin -p %2 -mse 0 -fb -pc -ignore-existing-overrides ..\..\%filename%

:END
cd ..\..
@echo on
