@echo off

set argC=0
for %%x in (%*) do Set /A argC+=1

IF %argC% NEQ 3 goto MESSAGE

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

cd winflash

if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto 64BIT
    
:32BIT
echo Windows x86 Environment
echo.
cd Win32
Yafuflash2.exe -vyes -nw -ip %1 -u %2 -p %3 -fb -pipmi -pauth -pnet -psnmp -pssh -pkvm -pntp -psel ..\..\%filename%
goto END

:64BIT
echo Windows x64 Environment
echo.
cd Win64
Yafuflash2.exe -vyes -nw -ip %1 -u %2 -p %3 -fb -pipmi -pauth -pnet -psnmp -pssh -pkvm -pntp -psel ..\..\%filename%
goto END

:MESSAGE
echo "[ERROR] : Insufficient Parameter!"
echo "win_oob-pc.bat <BMC_IP> <Username> <Password>"
goto TEND

:END
cd ..\..

:TEND
@echo on
