@echo off
setlocal enabledelayedexpansion
title Redmi Note 12 Turbo 安装 twrp

echo --------------------------------------------------------
echo        手机关机同时按电源键和音量减键
echo        直至手机屏幕出现fastboot再连接数据线至电脑
echo        twrp version:skkk-Android14
echo        本twrp支持虚拟SD卡挂载                                     
echo --------------------------------------------------------
pause
rem 检查设备是否连接 
META-INF\fastboot devices > connected_devices.txt
type connected_devices.txt | findstr "fastboot" > nul
if errorlevel 1 (
    echo 设备未进入Fastboot模式，请检查并重新打开bat文件
     pause
     del connected_devices.txt
     exit /b 1
    ) else (
echo 设备已连接
)

echo --------------------------------------------------------
echo                                    正在刷入twrp...
echo --------------------------------------------------------
META-INF\fastboot flash recovery_ab recovery.img

echo --------------------------------------------------------
echo                         刷入成功，正在重启至twrp
echo --------------------------------------------------------
pause
META-INF\fastboot reboot recovery
del connected_devices.txt
exit

