0

I want to create a batch file to automate adb wireless connect. How can I automatically connect ADB through WiFi? I have string IP adb shell "ip addr show wlan0 | grep 'inet ' | cut -d ' ' -f 6 | cut -d / -f 1" that returns my device IP

but if I try to connect it returns this:

D:\tools>adb connect "adb shell "ip addr show wlan0 | grep 'inet ' | cut -d ' ' -f 6 | cut -d / -f 1""
"grep" is not internal or external
command executed by a program or batch file.

How can I write this in one line and make a .bat script?

  • Instead of trying to make a one-liner I would try to first execute the adb shell command and save it's result in a variable you could then use in a second command. Otherwise the different. Windows cmd does not allow to use the output of one command as argument for a second command. See also https://stackoverflow.com/q/43225925/150978 – Robert Apr 17 '23 at 09:12

0 Answers0