@echo off chcp 65001 >nul setlocal enabledelayedexpansion echo ======================================== echo Enable ADB TCP/IP Mode (Port 5555) echo ======================================== echo. REM Get the directory where this batch file is located set "SCRIPT_DIR=%~dp0" set "PROJECT_ROOT=%SCRIPT_DIR%.." REM Read ADB path from adb-path-config.js using PowerShell echo [0/2] Reading ADB path from adb-path-config.js... for /f "delims=" %%i in ('powershell -Command "$content = Get-Content '%PROJECT_ROOT%\adb-path-config.js' -Raw; if ($content -match '\"adb-path\"\s*:\s*''([^'']+)''') { $adbPath = $matches[1]; $fullPath = $adbPath.TrimEnd([char]92) + [char]92 + 'adb.exe'; if (Test-Path $fullPath) { Write-Output $fullPath } else { Write-Output 'adb' } } else { Write-Output 'adb' }"') do set "ADB_PATH=%%i" if "%ADB_PATH%"=="" set "ADB_PATH=adb" echo Using ADB: %ADB_PATH% echo. echo [1/2] List connected devices... "%ADB_PATH%" devices echo. echo [2/2] Enable TCP/IP mode... "%ADB_PATH%" tcpip 5555 echo. echo ======================================== echo Done echo ======================================== echo. pause