言簡意賅的blog
手動敲擊命令
adb tcpip 5555
adb connect ip:port
adb devices
前提條件:你的電腦需要和手機在同一個局域網內並且這個手機要通過wifii已正常連接.
腳本內容
@echo off
set devices=CEQGLVQS55UCEMWO
if "%devices%" == "" set devices=
for /f "tokens=2 delims=:" %%i in ('adb -s %devices% shell ifconfig^|findstr "Bcast" ') do set ipaddr=%%i
for /f "tokens=1 delims=Bcast" %%i in ("%ipaddr%") do set ip=%%i
set ipport=%ip:~0,-2%
set ipport=%ipport%:5555
@echo off
@echo %ipport%
adb -s %devices% tcpip 5555
adb connect %ipport%
腳本執行情況
C:\Users\xielianshi\Desktop\adbtcp.bat
172.16.20.4:5555
restarting in TCP mode port: 5555
already connected to 172.16.20.4:5555
檢查設備是否成功連接
adb devices
List of devices attached
CEQGLVQS55UCEMWO device
172.16.20.4:5555 device
172.16.21.23:5555 device