rem @ECHO OFF

SET AfuPath32=AfuWin\AfuWin32\afuwin.exe
SET AfuPath64=AfuWin\AfuWin64\afuwinx64.exe
SET Rom=ROM\ASRock.ROM
SET Options=/B /P /K /N /SHUTDOWN

:CheckArgs
IF NOT "%1"=="" SET Rom=ROM\ASRock.ROM

:CheckOs
IF EXIST "%PROGRAMFILES(X86)%" (GOTO 64Bit) ELSE (GOTO 32Bit)

:32Bit
rem cd %AfuPath32%
SET Exe=%AfuPath32%
goto Main

:64Bit
rem cd %AfuPath64%
SET Exe=%AfuPath64%
goto Main

:Main
%Exe% %Rom% %Options%

:Exit