Page 1 of 1

how to echo out this list after the adb command

Posted: 14 Apr 2022 11:42
by goodywp
Hi All,
In Android project, adb is a much intensively used command. Now I have this command as below

Code: Select all

adb devices -l
Output is a list as below
List of devices attached
20ACCD801803 device product:DX8000 model:DX8000 device:DX8000 transport_id:1
2158CD823377 device product:DX8000 model:DX8000 device:DX8000 transport_id:3

Now my question is how to output the above list into a text file so that I can use it as a variable later. The reason for this is that the transport_id is dynamically changing after reboot, either from PC or a device.
So in case the PC or device reboot, I need a new variable for the transport_id so that I can use it for the next connection step to this particular device.

Any thoughts?

Thanks

Re: how to echo out this list after the adb command

Posted: 14 Apr 2022 11:54
by goodywp
Sorry I just found out it should use below to get output

Code: Select all

adb devices -l >>devicename.txt
and works