@echo off
rem ver. 0.6 date 27.11.2016
rem TWRP_nikel by Cofface update 20161124
rem http://en.miui.com/thread-352104-1-1.html
CLS
TITLE TWRP flasher for Xiaomi Redmi Note 4
COLOR 17
echo.
echo                               Created by D_Godunov
echo.
ECHO  ******************************************************************************
echo  *                                                                            *
echo  *                 This tool is only for Xiaomi Redmi Note 4                  *
echo  *              with Android Marshmallow and will flash TWRP3.                *
echo  *             Phone bootloader must be unlocked to use this tool.            *
echo  *                     Enter Fastboot mode to continue                        *
echo  *            by pressing and holding Volume Down and Power Button.           *
echo  *                                                                            *
ECHO  ******************************************************************************
echo.
ECHO          *************************************************************
echo          *                                                           *
echo          *          Make sure you are in Fastboot mode               *
echo          *                                                           *
ECHO          *************************************************************
echo.
fastboot.exe devices > devices_tmp
set /p DEVICES=<devices_tmp
del devices_tmp 2>NUL
IF DEFINED %DEVICES%. (
echo  %DEVICES%
echo  OK Device connected
) ELSE (echo Error: Device not connected & pause && exit /B 1)
echo  ...
fastboot.exe getvar product 2>&1 | findstr /r /c:"^product: nikel" || echo  Error: Mismatching ^
TWRP nikel image and device && pause && exit /B 1
echo.
CHOICE /C YN /M "Press key \"Y\" to flash TWRP, \"N\" to Exit."
IF %ERRORLEVEL% EQU 2 GOTO YES
echo.
fastboot.exe flash recovery twrp.img
fastboot.exe boot twrp.img
ECHO  ******************************************************************************
echo  *                                                                            *
echo  *                             Process completed                              *
echo  *          Format Data partition first to read Internal SD of XRN4           *
echo  *                                                                            *
echo  *                           Thanks for using tool!                           *
echo  *                                                                            *
ECHO  ******************************************************************************
echo.
pause
