0-ENABLE-TCPIP.BAT 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. @echo off
  2. chcp 65001 >nul
  3. setlocal enabledelayedexpansion
  4. echo ========================================
  5. echo Enable ADB TCP/IP Mode (Port 5555)
  6. echo ========================================
  7. echo.
  8. REM Get the directory where this batch file is located
  9. set "SCRIPT_DIR=%~dp0"
  10. set "PROJECT_ROOT=%SCRIPT_DIR%.."
  11. REM Read ADB path from adb-path-config.js using PowerShell
  12. echo [0/2] Reading ADB path from adb-path-config.js...
  13. 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"
  14. if "%ADB_PATH%"=="" set "ADB_PATH=adb"
  15. echo Using ADB: %ADB_PATH%
  16. echo.
  17. echo [1/2] List connected devices...
  18. "%ADB_PATH%" devices
  19. echo.
  20. echo [2/2] Enable TCP/IP mode...
  21. "%ADB_PATH%" tcpip 5555
  22. echo.
  23. echo ========================================
  24. echo Done
  25. echo ========================================
  26. echo.
  27. pause