Asus Zenfone 2 Laser ZE601KL

@echo off

set /a a=1


:loop

@set dataerase=1

@if [%1] NEQ [0] goto step1

@set dataerase=0

:step1

@set para=<nul

@if [%2] EQU [] goto step2

@set para=-s

fastboot_8916 devices | findstr %2

IF %ERRORLEVEL% NEQ 0 goto Error

:step2

@set fb=fastboot_8916 %para% %2

call image.bat gpt_both0.bin %1 %2

@ECHO OFF

IF %ERRORLEVEL% NEQ 0 goto Error

@ECHO ON

rem if not exist base_system_*.img goto all_update

goto all_update

awk -F”=” ‘{if($1==”Base_Image_Version_New”) print $2}’ build_info > base.txt

IF %ERRORLEVEL% NEQ 0 goto Error

set /p base=<base.txt

IF %ERRORLEVEL% NEQ 0 goto Error

awk -F”=” ‘{if($1==”PROJECT_BUILD_VERSION”){version=$2} if($1==”TARGET_SKU”){sku=$2}} END{print version”_”sku}’ build_info > now.txt

IF %ERRORLEVEL% NEQ 0 goto Error

set /p now=<now.txt

IF %ERRORLEVEL% NEQ 0 goto Error

if not exist base_system_%base%.img goto Error

%fb% erase system

%fb% flash system base_system_%base%.img

@ECHO OFF

IF %ERRORLEVEL% NEQ 0 goto Error

@ECHO ON

if not exist base_recovery_%base%.img goto Error

%fb% erase recovery

%fb% flash recovery base_recovery_%base%.img

@ECHO OFF

IF %ERRORLEVEL% NEQ 0 goto Error

@ECHO ON

%fb% erase cache

%fb% flash cache cache_ota.img

@ECHO OFF

IF %ERRORLEVEL% NEQ 0 goto Error

@ECHO ON

if not exist userdata_ota_%base%_%now%.img goto Error

%fb% flash userdata userdata_ota_%base%_%now%.img

@ECHO OFF

IF %ERRORLEVEL% NEQ 0 goto Error

@ECHO ON

@echo press any key to continue, system will reboot!

@pause

@%fb% oem reboot-recovery

@exit /b 0

:all_update

%fb% erase system

%fb% flash system system.img

@ECHO OFF

IF %ERRORLEVEL% NEQ 0 goto Error

@ECHO ON

%fb% oem adb_enable 1 > tmp.out 2> tmp.err

@IF %ERRORLEVEL% NEQ 0 goto Error

%fb% oem lock >nul 2>&1

%fb% oem device-info 2>&1 | findstr /C:”Device unlocked: false”

@ECHO OFF

IF %ERRORLEVEL% NEQ 0 (

echo “lock failed!!!”

exit /b 1

)

@ECHO ON

@echo press any key to continue, system will reboot!

rem @pause

@%fb% reboot

@exit /b 0

:Error

set /a a=%a%+1

if %a% LEQ 2 ( echo *******************************************************************************

echo Now,we will try it again!!!

echo *******************************************************************************

goto loop )^

else ( echo Update image failed!!! )

@exit /b 1

More from my site