back to top

How to Execute ADB Commands When Multiple Devices Are Connected

Follow Us
placeholder text

Welcome to this guide, where we unveil a clever technique for executing ADB commands on a single device when multiple devices are connected. If you have stumbled upon this post, you may be wondering why anyone would need to perform this task in the first place. Well, I had the same question until I encountered this situation myself.

Back in the early days of my YouTube channel, I used an app on my phone to record videos that required USB debugging to be enabled. Since my videos were centered around rooting and flashing-related topics, I already had a device connected to my PC. Consequently, whenever I ran the adb devices command, my PC would detect two connected devices.

This situation made me cautious about executing the necessary commands because it could potentially impact an unintended device (in this case, my recording device). To address this concern, I delved deeper into research and discovered a method specifically designed to execute ADB commands on a single phone even when multiple devices are connected. In this guide, we will explain the steps to achieve this. Stay with us to learn more.

How to Execute ADB Commands When Multiple Devices Are Connected

To begin, follow these steps to execute ADB commands when multiple devices are connected:

  1. First, download and extract the Android SDK Platform Tools on your PC.
  2. Enable USB debugging on one of your devices and connect it to your PC.
  3. Open the Command Prompt by typing “CMD” in the address bar of the platform tools and pressing Enter.
  4. In the Command Prompt, execute the following command: Copy code adb devices. This command will provide you with a serial ID. Take note of the serial ID and the device name.
  5. Connect your second device to your PC and execute the same command again.
  6. Once again, note down the serial ID and the device name.

From now on, you will use the serial ID to execute the desired ADB command. The general syntax for executing commands on a specific device is as follows (replace “serial_ID” and “command” accordingly):

adb -s serial_ID command

To illustrate this further, let us consider a few commands. In my case, “6ddfaeb8” corresponds to the Poco F4 (munch), while “c07c4a1a” corresponds to the OnePlus 7T.

ADB Shell Commands When Two Devices Are Connected

If you want to execute a shell command on the Poco F4 (munch), use the following command:

adb -s 6ddfaeb8 shell

For the OnePlus 7T, the command would be:

adb -s c07c4a1a shell

Fastboot Commands When Two Devices Are Connected

To boot the Poco F4 into Fastboot Mode, use the command:

adb -s 6ddfaeb8 reboot bootloader

To verify the same, type the following command, and you will get the same serial ID as above (in my case, “6ddfaeb8”):

fastboot devices  

Reboot to Recovery When two devices are connected.

If you want to boot the OnePlus 7T into recovery mode, use the following command:

adb -s c07c4a1a reboot recovery

That is it! These were the steps to execute ADB commands on a single device when multiple devices are connected. We have also provided a few example commands to help you understand this slightly complex topic. If you have questions regarding the abovementioned steps, please let us know in the comments. We will provide you with a solution as soon as possible.

Conclusion

This guide explains how to execute ADB commands on a single device when multiple devices are connected. We covered the necessary steps and provided examples of the ADB shell and Fastboot command. Following these instructions ensures that the desired ADB commands are executed on the intended device, even when multiple devices are connected. If you have further questions or need additional assistance, feel free to comment; we will be happy to help you.