Created
October 9, 2018 10:18
-
-
Save IdrisN/80b7c281f735cbdb17c841b3f3875b2d to your computer and use it in GitHub Desktop.
Batch script to enable wireless adb with just one command
This file contains hidden or 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
| FOR /F "tokens=9 delims= " %%a in ('adb shell ip route') do ( | |
| set ip=%%a | |
| ) | |
| adb tcpip 5555 | |
| set ipwithport=%ip%:5555 | |
| adb connect %ipwithport% |
Author
Hello, and thank you.
I have three questions (sorry if I'm asking about obvious things, I'm learning this on my own):
- Does this command find out the Android's IP on its own somehow? (the for loop contents confuse me here)
- How does it know?
- Also, am I supposed to replace
'adb shell ip route'with the following?
C:\Users\MyUser\WhereMyAdbFilesAreLocated\platform-tools\
Thank you for sharing your code and for any patient answers you are able to provide.
P.S.
I also stumbled upon an article you may or may not be interested in, related to the topic of your code.
Disclaimer: The article is not mine and I have no relation to its author; But I found his method to be quite comprehensive (if perhaps unnecessarily convoluted for some), and encompassing.
If you're interested (I hope I'm not braking any rules by posting an external link here):
https://copyprogramming.com/howto/batch-script-for-adb-connect-over-wifi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CutIt
Wireless ADB with one command
The usual procedure to set up a wireless adb connection has to many steps in my opinion:
adb tcpip 5555adb connect <ip>:5555See? Takes way too much time. Especially the IP look-up.
The provides batch script reduces the procedure to the following
cutitDone!
Remarks