@ECHO OFF
setlocal enabledelayedexpansion
set STORAGE_TYPE=unknown
del fastboot.log
fastboot getvar version-bootloader
echo "Saving log to fastboot.log"
echo "flash partition:0 gpt_both0.bin…"
fastboot flash partition:0 gpt_both0.bin 2> fastboot.log
findstr "FAILED error" fastboot.log
IF !errorlevel! == 0 (
echo "failed and exit"
pause
goto end
)
echo "flash partition:1 gpt_both1.bin…"
fastboot flash partition:1 gpt_both1.bin 2> fastboot.log
findstr "FAILED error" fastboot.log
IF !errorlevel! == 0 (
echo "failed and exit"
pause
goto end
)
echo "flash partition:2 gpt_both2.bin…"
fastboot flash partition:2 gpt_both2.bin 2> fastboot.log
findstr "FAILED error" fastboot.log
IF !errorlevel! == 0 (
echo "failed and exit"
pause
goto end
)
echo "flash partition:3 gpt_both3.bin…"
fastboot flash partition:3 gpt_both3.bin 2> fastboot.log
findstr "FAILED error" fastboot.log
IF !errorlevel! == 0 (
echo "failed and exit"
pause
goto end
)
echo "flash partition:4 gpt_both4.bin…"
fastboot flash partition:4 gpt_both4.bin 2> fastboot.log
findstr "FAILED error" fastboot.log
IF !errorlevel! == 0 (
echo "failed and exit"
pause
goto end
)
echo "flash partition:5 gpt_both5.bin…"
fastboot flash partition:5 gpt_both5.bin 2> fastboot.log
findstr "FAILED error" fastboot.log
IF !errorlevel! == 0 (
echo "failed and exit"
pause
goto end
)
echo "erase misc…"
fastboot erase misc 2>>fastboot.log
findstr "FAILED error" fastboot.log
IF %errorlevel% == 0 (
echo "failed and exit"
pause
goto end
)
REM echo "flash bootloader bootloader.img …"
REM fastboot flash bootloader bootloader.img 2>fastboot.log
echo "flash bootloader bootloader.img…"
fastboot flash bootloader bootloader.img 2>>fastboot.log
findstr "FAILED error" fastboot.log
IF %errorlevel% == 0 (
echo "failed and exit"
pause
goto end
)
echo "flash dsp adspso.bin …"
fastboot flash dsp adspso.bin 2>>fastboot.log
findstr "FAILED error" fastboot.log
IF %errorlevel% == 0 (
echo "failed and exit"
pause
goto end
)
echo "flash mdtp mdtp.img …"
fastboot flash mdtp mdtp.img 2>>fastboot.log
findstr "FAILED error" fastboot.log
IF %errorlevel% == 0 (
echo "failed and exit"
pause
goto end
)
echo "flash splash splash.img…"
fastboot flash splash splash.img 2>>fastboot.log
findstr "FAILED error" fastboot.log
IF %errorlevel% == 0 (
echo "failed and exit"
pause
goto end
)
echo "flash asusfw asusfw.img…"
fastboot flash asusfw asusfw.img 2>>fastboot.log
findstr "FAILED error" fastboot.log
IF %errorlevel% == 0 (
echo "failed and exit"
pause
goto end
)
echo "reboot-bootloader…"
fastboot reboot-bootloader 2>>fastboot.log
findstr "FAILED error" fastboot.log
IF %errorlevel% == 0 (
echo "failed and exit"
pause
goto end
)
echo "wait for 5 seconds for bootloader to be ready…"
PING 127.0.0.1 -n 6
echo "flash modem NON-HLOS.bin…"
fastboot flash modem NON-HLOS.bin 2>>fastboot.log
findstr "FAILED error" fastboot.log
IF !errorlevel! == 0 (
echo "failed and exit"
pause
goto end
)
echo "flash boot boot.img…"
fastboot flash boot boot.img 2>>fastboot.log
findstr "FAILED error" fastboot.log
IF %errorlevel% == 0 (
echo "failed and exit"
pause
goto end
)
echo "flash recovery recovery.img…"
fastboot flash recovery recovery.img 2>>fastboot.log
findstr "FAILED error" fastboot.log
IF %errorlevel% == 0 (
echo "failed and exit"
pause
goto end
)
echo "flash system system.img…"
fastboot flash -S 128M system system.img 2>>fastboot.log
findstr "FAILED error" fastboot.log
IF %errorlevel% == 0 (
echo "failed and exit"
pause
goto end
)
echo "format ADF…"
fastboot format ADF 2>>fastboot.log
findstr "FAILED error" fastboot.log
IF %errorlevel% == 0 (
echo "failed and exit"
pause
goto end
)
echo "format asdf…"
fastboot format asdf 2>>fastboot.log
findstr "FAILED error" fastboot.log
IF %errorlevel% == 0 (
echo "failed and exit"
pause
goto end
)
echo "format metatdata…"
fastboot erase metadata 2>>fastboot.log
findstr "FAILED error" fastboot.log
IF %errorlevel% == 0 (
echo "failed and exit"
pause
goto end
)
fastboot oem uart-off
fastboot -w reboot
pause
:end