@echo off
If %MeUpdateFlag% == 37 goto ME16A
If %MeUpdateFlag% == 36 goto ME16
If %MeUpdateFlag% == 35 goto ME15
If %MeUpdateFlag% == 34 goto ME15A
If %MeUpdateFlag% == 33 goto ME1112
If %MeUpdateFlag% == 32 goto ME12
If %MeUpdateFlag% == 31 goto ME11
If %MeUpdateFlag% == 30 goto ME10

If %MeUpdateFlag% == 17 goto ME1314
If %MeUpdateFlag% == 16 goto ME16
If %MeUpdateFlag% == 15 goto ME15
If %MeUpdateFlag% == 14 goto ME14
If %MeUpdateFlag% == 13 goto ME13
If %MeUpdateFlag% == 12 goto ME12
If %MeUpdateFlag% == 11 goto ME11
If %MeUpdateFlag% == 10 goto ME10
goto Done

:ME16
:ME16A
:ME15
:ME15A
echo Should not be here.
goto Done

:ME1314
Set MeFolder=F134914
Set NewMEVersion=9.1.42.3002
Set MeFile=914230
goto CheckMe

:ME14
Set MeFolder=F14100
Set NewMEVersion=10.0.56.3002
Set MeFile=100563
goto CheckMe

:ME13
Set MeFolder=F13956
Set NewMEVersion=9.5.62.3002
Set MeFile=956230
goto CheckMe

:ME12
Set MeFolder=F12817
Set NewMEVersion=8.1.72.3002
Set MeFile=81723002.bin
goto CheckMe

:ME1112
Set MeFolder=F8171
Set NewMEVersion=8.1.71.3608
Set MeFile=81713608.bin
echo Need systems to develop the tool.
pause
goto done
goto CheckMe

:ME11
Set MeFolder=F7191
Set NewMEVersion=7.1.91.3272
Set MeFile=71913272.bin
goto CheckMe

:ME10
Set MeFolder=F6261
Set NewMEVersion=6.2.61.3535
Set MeFile=626135~2.bin
goto CheckMe

:CheckMe
:MeUpdate\%MeFolder%\MEInfo.exe -feat "FW Version" > MeVer.txt
MeUpdate\%MeFolder%\MEInfo.exe > MeVer.txt
ChkMeVer.exe MeVer.txt %NewMEVersion%
IF ERRORLEVEL 6 goto MeFwH
IF ERRORLEVEL 5 goto MeFwLP
IF ERRORLEVEL 4 goto MeFw
IF ERRORLEVEL 3 goto NoNeed2Update
IF ERRORLEVEL 2 goto ErrorToUpdate

:ErrorToUpdate
Echo ***** Check Error Message *****
pause
Goto Done

:MeFwH
Set MeFile=%MeFile%~1.bin
Echo Update file %MeFile%
Goto UpdateNow

:MeFwLP
Set MeFile=%MeFile%~2.bin
Echo Update file %MeFile%
Goto UpdateNow

:MeFw
Echo Update file %MeFile%
Goto UpdateNow

:NoNeed2Update
:Echo No Need to update ME Firmware.
Goto Done

:UpdateNow
pause
If %MeUpdateFlag% == 10 goto ME62
MeUpdate\%MeFolder%\FWUpdLcl.exe -f MeUpdate\%MeFolder%\%MeFile%
Goto Done

:ME62
MeUpdate\%MeFolder%\FWUpdLcl.exe MeUpdate\%MeFolder%\%MeFile%

:Done
:exit
pause
