Last active
November 15, 2023 15:32
-
-
Save am3n/589e9a1f9dc588f7b6aabbd8fc0baf64 to your computer and use it in GitHub Desktop.
Wi-Fi ADB batch script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@setlocal enableextensions enabledelayedexpansion | |
@echo off | |
for /F "tokens=*" %%A in ('adb devices') do ( | |
set str1=%%A | |
if "x!str1:List=!"=="x!str1!" ( | |
if "x!str1::5555=!"=="x!str1!" ( | |
set id=!str1:device=! | |
adb -s !id! tcpip 5555 | |
timeout /T 2 /NOBREAK > nul | |
for /F "tokens=*" %%A in ('adb -s !id! shell "ip addr show wlan0 | grep -e wlan0$ | cut -d\" \" -f 6 | cut -d/ -f 1"') do ( | |
set ip=%%A | |
echo !ip! !id! | |
adb -s !id! connect !ip! | |
) | |
) | |
) | |
) | |
@endlocal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
By running this script, the remote adb connection will be established with all the devices that are connected via USB and also connected to the local network.
You can put this script in
sdk\platform-tools\
so that you can easily run it through the terminal.