@echo off
setlocal enabledelayedexpansion
chcp 65001 >nul

echo ---------------------------------------------------------------
echo              Script lock - unlock bootloader
echo ---------------------------------------------------------------
echo   -----------------------------------------------------------
echo       If you understand what you are doing, press any key
echo   -----------------------------------------------------------
pause

echo.
echo Select unlock method:
echo   1. New  (fastboot flashing unlock)  - Pixel 6 and newer
echo   2. Old  (fastboot oem unlock)       - older devices
echo.
set "METHOD="
set /p "METHOD=Enter 1 or 2: "

if "%METHOD%"=="1" (
  set "CMD=fastboot flashing unlock"
) else if "%METHOD%"=="2" (
  set "CMD=fastboot oem unlock"
) else (
  echo Invalid choice. Exiting.
  pause
  exit /b 1
)

echo.
echo        ................................................
echo        .              Check ADB Devices               .
echo        ................................................
adb devices

echo        ................................................
echo        .          Reboot device to bootloader         .
echo        ................................................
adb reboot bootloader
echo  please wait for device to enter bootloader
timeout 30 /nobreak

echo        ................................................
echo        .            Check fastboot Devices            .
echo        ................................................
fastboot devices

echo        ................................................
echo        .          Unlock bootloader command           .
echo        ................................................
echo If you are waiting more than 1 minute, check drivers in device manager
%CMD%

echo.
echo Done. Confirm the unlock on the phone screen if prompted.
pause
