@echo off  

 
echo *************************************************************************
echo,
echo               updateWin.bat BIOS.bin [param1] [param2]
echo,
echo,  
echo	param1:/P:Preserve BIOS Setup; /NP: Not Preserve BIOS Setup
echo	param2:/ME:refresh ME; /NOME:None refresh ME
echo,
echo	eg:
echo	1.AFU Preserve BIOS Setup, refresh ME
echo	.\updateWin.bat  BIOS.bin /P /ME
echo	2.AFU Preserve BIOS Setup, None refresh ME
echo	.\updateWin.bat  BIOS.bin /P /NOME
echo	3.AFU Not Preserve BIOS Setup, refresh ME
echo	.\updateWin.bat  BIOS.bin /NP /ME
echo	4.AFU Not Preserve BIOS Setup, None refresh ME
echo	.\updateWin.bat  BIOS.bin /NP /NOME
echo	5.The same instruct as 1. :
echo	.\updateWin.bat  BIOS.bin
echo	6.The same instruct as 2. :
echo	.\updateWin.bat  BIOS.bin /NOME
echo	7.The same instruct as 3. :
echo	.\updateWin.bat  BIOS.bin /NP
echo,
echo *************************************************************************

if not exist %windir%\System32\drivers\imbdrv.sys goto exit
 goto start
 
:exit
echo imbdrv.sys is not exist!!!

echo zhangzr install Intel IMB driver!!!
echo,
install.bat .\


:start
echo imbdrv.sys is exist!


if /i %PROCESSOR_IDENTIFIER:~0,3%==x86 (
    echo x86 32 zhangzr
	
	if "%2"=="/NP" (
		echo "NONE preserve"
	)else if "%2"=="/np" (
		echo "NONE preserve"
	)else if "%3"=="/NP" (
		echo "NONE preserve"
	)else if "%3"=="/np" (
		echo "NONE preserve"
	)else (
		echo "preserve"
		start ipmitool raw 0x3c 0x4a 0x0b 0x01 0x20 0x00
		
	)
	
	if "%2"=="/NOME" (
		echo "/b /p /n /k /l /x "
		.\AFUWINx64.EXE %1 /b /p /n /k /l /x
	)else if "%2"=="/nome" (
		echo "/b /p /n /k /l /x "
		.\AFUWINx64.EXE %1 /b /p /n /k /l /x
	)else if "%3"=="/NOME" (
		echo "/b /p /n /k /l /x "
		.\AFUWINx64.EXE %1 /b /p /n /k /l /x 
	)else if "%3"=="/nome" (
		echo "/b /p /n /k /l /x "
		.\AFUWINx64.EXE %1 /b /p /n /k /l /x 
	)else  (
		echo "/b /p /n /k /l /x /ME " 
		
		.\AFUWIN.EXE %1 /b /p /n /k /l /x /ME
		
		echo WARNING : The changes of PHY take effect, System must AC power-off!!!
	)
	
	
)else (
    echo x86_64	zhangzr 

	if "%2"=="/NP" (
		echo NONE preserve
	)else if "%2"=="/np" (
		echo NONE preserve
	)else if "%3"=="/NP" (
		echo NONE preserve
	)else if "%3"=="/np" (
		echo NONE preserve
	)else (
		echo preserve
		start ipmitool raw 0x3c 0x4a 0x0b 0x01 0x20 0x00
		
	)
	
	if "%2"=="/NOME" (
		echo "/b /p /n /k /l /x "
		.\AFUWINx64.EXE %1 /b /p /n /k /l /x
	)else if "%2"=="/nome" (
		echo "/b /p /n /k /l /x "
		.\AFUWINx64.EXE %1 /b /p /n /k /l /x
	)else if "%3"=="/NOME" (
		echo "/b /p /n /k /l /x "
		.\AFUWINx64.EXE %1 /b /p /n /k /l /x 
	)else if "%3"=="/nome" (
		echo "/b /p /n /k /l /x "
		.\AFUWINx64.EXE %1 /b /p /n /k /l /x 
	)else  (
		echo "/b /p /n /k /l /x /ME " 

		.\AFUWINx64.EXE %1 /b /p /n /k /l /x /ME 
		
		echo WARNING : The changes of PHY take effect, System must AC power-off!!!
	)
	
)





