In this guide, we will show you a nifty method to execute ADB Commands to a single device when multiple devices are connected. If you come across this post, then the first query that would come to your mind is why would anyone carry out this task in the first place. Well, initially I also had the exact same query until I manually came across this situation.
During the early days of my YouTube channel, I used to record via an app installed on my phone that required you to enable USB Debugging. And for the unaware, all my videos are on rooting and flashing related stuff, so I already had a device connected to my PC. Henceforth, whenever I executed the adb devices commands, my PC identified two connected devices.
Henceforth I was skeptical to execute the required command because it also end up affecting the device on which I didn’t intend to [which was my recording device]. So I did some further research and found out that there did exist a method through which you could execute ADB Commands specifically at a single phone when multiple devices are connected. And in this guide, we will show you how to do just that. Follow along.
Table of Contents
How to Execute ADB Commands when Multiple Devices are Connected
- First off, download and extract Android SDK Platform Tools on your PC.
- Then enable USB Debugging on one of your devices and connect it to PC.
- Now type in CMD in the address bar of platform tools and hit Enter.
- It will launch Command Prompt. Now execute the below command.
adb devices
- It will give you a serial ID, note it down somewhere along with the device name.
- Then connect your second device to your PC as well and again execute the same command.
- You will again get a serial ID, note it down somewhere along with the device name.
- So from now onwards, we will be using the serial ID to execute the desired ADB Command.
- The general syntax for the same is as follows [make sure to replace serial ID and command according to your need]:
adb -s serial_ID command
- Let’s understand this with the help of a few commands. In my case, 6ddfaeb8 is for Poco F4 [much] whereas c07c4a1a is for OnePlus 7T
ADB Shell Commands when Two Devices are Connected
- In the case of my Poco F4 [munch], it will be
adb -s 6ddfaeb8 shell
- For OnePlus 7T, it will be:
adb -s c07c4a1a shell
Fastboot Commands when Two Devices are Connected
- For instance, if I want to boot Poco F4 to Fastboot Mode, then the command will be
adb -s 6ddfaeb8 reboot bootloader
- To verify the same, type in the below command and you’ll get the same serial ID as above [which in my case is 6ddfaeb8].
fastboot devices
- To flash any file to one of these devices, you may use the below command syntax:
fastboot -s serial_ID command
- For example, if you want to flash twrp.img to the OnePlus device having serial ID c07c4a1a, the above command will transform to:
fastboot -s c07c4a1a flash recovery twrp.img
Reboot to Recovery When Two Devices are Connected
- For example, if I want to boot my OnePlus 7T to Recovery Mode, then the command will be:
adb -s c07c4a1a reboot recovery
That’s it. These were the steps to execute ADB Commands to a single device when multiple devices are connected. We have also listed a few commands to make it easier to understand this slightly complex topic. With that said, if you have any queries concerning the aforementioned steps, do let us know in the comments. We will get back to you with a solution at the earliest.