In this guide, we will show you the detailed steps to add ADB to System Variables Path on your Windows 11 PC. One of the biggest perks of having an open-source OS like Android is the ability to try out a plethora of tweaks. These include the likes of unlocking the device’s bootloader, installing customized firmware, or installing a custom recovery like TWRP. Along the same lines, you could also gain administrative privileges and access to the system partition by rooting your device via Magisk.
However, before you could actually try out any of these tweaks, you need to have the ADB and Fastboot set up on your PC. Be it for carrying out basic tasks like booting the device to Fastboot or Recovery Mode, or even carrying out advanced functionalities like flashing stock firmware via Fastboot Commands, all of these wouldn’t be possible until and unless you have added the ADB to System Variables Path on your Windows 11 PC. So without further ado, let’s get started with the instruction steps.
Table of Contents
The below instructions are listed under separate sections for ease of understanding. Make sure to follow in the exact same sequence as mentioned.
STEP 1: Install Android SDK
First and foremost, you will have to install the Android SDK Platform Tools on your PC. This is the official ADB and Fastboot binary provided by Google and is the only recommended one. So download it and then extract it to any convenient location on your PC. Doing so will give you the platform-tools folder, which will be used throughout this guide.
STEP 2: Enable USB Debugging
Next up, you will have to enable USB Debugging so that your device is recognizable by the PC in ADB mode. This will then also allow you to boot your device to Fastboot Mode. So head over to Settings > About Phone > Tap on Build Number 7 times > Go back to Settings > System > Advanced > Developer Options > Enable USB Debugging.
STEP 3: Add ADB to System Variables Path in Windows 11
- To begin with, launch File Explorer via Windows+E shortcut keys and head over to the platform-tools folder. Then copy its location from the address bar.
- Next up, head over to the Start menu, search View Advanced System Settings, and open it.
- You shall now be taken to the Advanced tab of System Properties.
- Click on the Environmental Variables button situated at the bottom right.
- Now select the Path field under System Variable and click on the Edit button.
- After that, click on the New button and paste the platform-tools folder location (that you had earlier copied) in the space provided.
- Then click OK to save this path. Again click OK to close Environmental Variable and finally click OK to close System Properties.
- That’s it. Now restart your PC (optional but recommended) and your tasks stand complete.
STEP 4: Test the ADB Path
Now that you have successfully added ADB to System Variables Path on your Windows 11 PC, it’s time to put it to the test! First off, we will test the ADB connection followed by the Fastboot Connection. Follow along.
- To begin with, connect your device to the PC via USB cable. Make sure USB Debugging is enabled.
- Then head over to the platform-tools folder, type in CMD in the address bar, and hit Enter. This will launch the Command Prompt.
- Now type in the following command in the CMD window to verify the ADB Connection.
adb devices
- You should now get the device ID indicating that the connection has been successfully established
- After that, type in the below command to boot your device to Fastboot Mode
adb reboot bootloader
Fastboot Mode in OnePlus - Now let’s verify the Fastboot connection. So type in the below command and hit Enter
fastboot devices
- You should get your device ID. This signifies that the Fastboot connection has been successfully established.
- if you don’t get any device ID, then make sure to install Fastboot Drivers onto your PC.
With this, we round off the guide on how you could add ADB to System Variables Path on your Windows 11 PC. 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.
- How to Fix All ADB and Fastboot Errors
- Fix Waiting for Device Error in ADB or Fastboot Commands
- Fix adb server version doesn’t match this client; killing…
- How to Fix FAILED (remote: Partition flashing is not allowed)
How to Use ADB or Fastboot From Any Directory on your Windows/Linux PC
Sign in to your XDA account
If you’ve followed our tutorial on how to setup the adb and fastboot platform tools on your computer, it might be annoying to have to navigate to the folder every time, especially if you use either tool quite frequently. Having to copy files to the platform tools folder is also annoying whenever you want to flash stuff on your device. For me it’s frustrating as I use an SSD and I dislike having to copy my files to my platform tools folder, and then delete them after. However, it’s possible to run the adb or fastboot tools from any directory on your Windows or Linux PC so you’ll never have to change directories to run any commands.
What is the PATH system variable?
PATH is used by Windows to specify the location of important executables. Usually, these are files located in the system directories, such as C:\Windows and C:\Windows\system32. This is why you can type «calc» in the command prompt to launch calculator, but not «chrome» to launch Google Chrome. This variable is sometimes changed by applications when you install them, such as Java. Java adds itself to the PATH variable on installation, meaning you can use Java from any directory. This is useful to people using Java applications so the program does not have to attempt to hard code the Java location.
We will be modifying the PATH system variable to allow us to use adb or Fastboot anywhere on our Windows computer. PATH also exists on Linux and usually contains the bin and sbin directories. I will cover how to add the platform tools to the Linux PATH variable too.
Note: Both tutorials require administrator/sudo access. Adding to Windows has two methods. I strongly suggest the first, but both work fine and the second is better if you plan to use the PATH variable a lot.
Adding adb and Fastboot to the Windows PATH (Method 1)
This isn’t really adding it to the Windows PATH variable per se, but more adding it to a folder that is already in the PATH variable. Simply copy your adb.exe, fastboot.exe, AdbWinApi.dll and AdbWinUsbApi.dll to C:\Windows and you’re good to go. You should be able to run adb and fastboot from the command line now. This is by far the easiest, most fool proof method for setting this up. If for whatever reason it doesn’t work, follow method 2.
Adding adb and Fastboot to the Windows PATH (Method 2)
Step 1
Open Windows Explorer and right click «My PC». Select «Properties» and you will be greeted with a screen showing some system information.
Step 2
Select «Advanced System Settings».
Step 3
Select «Environment Variables»
Step 4
Look for the variable named «Path» and double click it.
Step 5
Click «Browse» and navigate to the folder where you extracted your adb files. Next «okay» out of all of the Windows you have open. Start a new PowerShell or command prompt and type «adb» to verify the location has been added. If not, reboot your PC and try again.
Please ensure before you click «Browse» that no field is highlighted. If a field is highlighted you will end up replacing it. Click somewhere in the list that doesn’t contain an entry to ensure that you do not replace a field.
Adding adb and Fastboot to the Linux PATH
I will be using Ubuntu for this tutorial, via command line only. You can edit the .bashrc file via the GUI, but you will need to navigate to the root of your home directory and press Ctrl+H. Make sure you have the platform-tools downloaded and extracted.
Step 1
Note the path of the adb tools you extracted. For me, I extracted them to /home/adam/adb/platform-tools.
Step 2
You’ll need to edit your .bashrc file. Go back to your home directory and run the following command.
sudo nano .bashrc
If you prefer to use vi or gedit you can instead.
Step 3
Add the following line to the end of the .bashrc file. Be careful editing this file, do not add anything else or change anything else.
export PATH=${PATH}:/home/YOUR-USERNAME/path/to/adb
And type
adb
to check if it works. If it gives you an error (usually on 64-bit computers), install the packages glibc.i686 and libstdc++ and it should work.
Done!
You are now done, you should now be able to simply execute the adb or fastboot commands from anywhere on your Windows or Linux computer. As I said, this is incredibly useful and also allows for better organization so that you don’t need to put all of your flashable files in the same folders.
ANDROID
ADB (Android Debug Bridge) is a crucial tool for Android developers, allowing you to communicate with Android devices from your computer. It acts as a bridge between your PC and Android device, offering a wide variety of functionalities such as app installation, device management, and debugging. Setting up the ADB Path on Windows can streamline your development process and allow for seamless interactions with your connected devices.
What is ADB?
ADB is a versatile command-line tool that enables various actions on Android devices connected to your computer via USB or wirelessly. This tool is included in the Android Software Development Kit (SDK) and is essential for app developers and advanced users looking to manipulate and debug their applications or operating systems.
Key Features of ADB:
-
Install and uninstall applications on an Android device.
-
Copy files between your PC and the device.
-
Run shell commands to interact directly with Android’s operating system.
-
Log system messages and debug applications.
Prerequisites for Setting Up ADB on Windows
Before setting up the ADB path on your Windows system, ensure that you have the following:
-
Android SDK: Download and install the Android Studio or standalone SDK tools, which include ADB.
-
USB Drivers: Install the appropriate USB drivers for your Android device. This can often be done via the manufacturer’s website.
-
Developer Options: Enable Developer Options on your Android device by going to Settings > About phone and tapping on the Build number seven times.
-
USB Debugging: Once Developer Options is enabled, navigate to Settings > Developer options and enable USB debugging.
Step-by-Step Guide to Setting Up ADB Path on Windows
Follow these detailed steps to add ADB to your Windows Path variable and make ADB commands accessible from the command line.
Step 1: Locate ADB
-
Open File Explorer and navigate to the directory where the Android SDK is installed. By default, the path might look like:
C:\Users\<Your_Username>\AppData\Local\Android\Sdk
Alternatively, if you installed Android Studio, you can find ADB in:
C:\Program Files\Android\Android Studio\sdk\platform-tools
Step 2: Copy the ADB Path
-
Once you have located the
platform-tools
directory, click on the address bar in File Explorer to highlight the path. Copy this path. It should look something like:C:\Users\<Your_Username>\AppData\Local\Android\Sdk\platform-tools
Step 3: Edit the Environment Variables
-
Open the Start Menu and search for “Environment Variables” or “Edit the system environment variables”.
-
Select “Environment Variables” from the System Properties window.
-
In the Environment Variables window, locate and select the Path variable under System variables and click Edit.
-
In the Edit Environment Variable window, click New and paste the ADB path you copied earlier.
-
Click OK to close the dialog boxes.
Step 4: Verify ADB Installation
-
Open Command Prompt by pressing
Win + R
, typingcmd
, and hitting Enter. -
Type the following command and hit Enter:
-
If ADB is set up correctly, you will see the version information displayed, confirming that the setup is complete.
Example of ADB Commands
Here are some common ADB commands to get you started:
-
List connected devices:
-
Install an APK:
-
Uninstall an application:
adb uninstall com.package.name
-
Access a shell on the device:
Troubleshooting Common Issues
If you encounter problems with ADB, here are some common solutions:
-
No Devices Listed: Ensure that USB debugging is enabled on your device and that the device is properly connected.
-
ADB Not Recognized: Double-check that you’ve correctly set the ADB path in the Environment Variables.
-
Driver Issues: Make sure the proper USB drivers for your device are installed and updated.
Conclusion
Setting up ADB is a fundamental step for Android developers looking to enhance their productivity and streamline device interactions. By configuring the ADB path on your Windows system, you enable efficient communication with your Android devices, making it easier to debug, install applications, and manage files.
For more advanced functionalities, you can delve deeper into ADB’s extensive command list and explore its capabilities. With ADB set up, you will be well on your way to a smoother and more productive Android development experience.
Keywords to Remember
-
ADB Installation
-
Android Debugging
-
Windows Environment Variables
-
Command-Line Tools for Android
-
Android SDK
By following the steps outlined in this article, you’re now equipped to utilize ADB effectively in your Android development projects. Happy coding!
Suggested Articles
ANDROID
ANDROID
ANDROID
Android App Bars vs Toolbars vs Other Bars, Explained
Explore the key differences between app bars, toolbars, and other essential UI components in Android app development in our comprehensive blog post. Learn how to effectively implement these elements to enhance navigation, streamline actions, and improve user experience. Master the best practices for using app bars and toolbars to create intuitive, user-friendly applications.
ANDROID
ANDROID
ANDROID
Quick Links
-
What Is the Windows System PATH?
-
How to Add a Folder to Your PATH
Summary
The PATH tells Windows where it should look for executables, making them accessible via command-line interfaces or scripts. To add a new folder to PATH, navigate to Advanced System Settings > Environment Variables, select PATH, click «Edit» and then «New.»
Have you ever wondered why you can just type ipconfig into a command prompt and it works, but when you want to use a command line program you downloaded you have to navigate to its directory first? Here’s how to fix that using the Windows System PATH on Windows 10 and Windows 11.
What Is the Windows System PATH?
The Windows System PATH tells your PC where it can find specific directories that contain executable files. Ipconfig.exe, for example, is found in the C:\Windows\System32 directory, which is a part of the system PATH by default. When you type ipconfig into a Command Prompt, Windows doesn’t need to know where that EXE is—it’ll check all the folders in its PATH until it finds the right one.
If you’ve downloaded a program that uses a command-line interface—like ADB, the Android Debug Bridge—you can’t just type adb in the Command Prompt or PowerShell to run it, like you can with Windows’ built-in commands (e.g.ipconfig). Instead, you have to tell Command Prompt where to find that file, by typing in the full path of the EXE:
C:\Android\platform-tools\adb.exe
If you don’t, you’ll get an error message like this.
That’s a lot of typing, especially for something you have to run often.
If you want the same convenience with a program you downloaded (like ADB), you need to add its folder to Windows’ system PATH. That way, when you need to run adb, you can just run:
adb
No extra typing necessary.
How to Add a Folder to Your PATH
These steps are basically the same on Windows 10 and Windows 11. There are just some minor differences in the user interface.
Start by pressing the Windows key to open up the Start Menu, then search for «advanced system settings.» You can alternatively browse through Control Panel to System and Security > System and click on the «Advanced system settings» hyperlink in the left-hand pane.
Once the System Properties window opens, click on the «Environment Variables» button.
In the «System Variables» box, look for a variable called Path. Select that and click on the «Edit» button.
You can modify the PATH for only the current user by changing the PATH variable under «User Variables.» It won’t affect other users, however. In many cases, it is better and more convenient to add something to the system PATH, so it is universally accessible on your PC.
This process is both easier and less confusing in Windows 10 and Windows 11 than it was in earlier versions of Windows. Once you’ve clicked the edit button, a new dialog box will appear with each location in the PATH on a separate line. This is a dramatic improvement over the way previous versions of Windows handled PATH locations and makes easy work of adding a new one.
First, click the ‘new’ button, which will add a line at the end of the list. Add your location—»C:\AndroidSDK» in our example—and hit Enter. Click the «OK» button and you’re finished.
Older versions of Windows required each line end with a semi-colon, but Windows 10 and 11 do not if you use the user interface like we are here. If you use a command-line interface to edit the PATH, you’ll still find them there.
The Android Debugging Bridge should now be accessible from any Command Prompt, PowerShell, or Windows Terminal, with no need to specify its directory.
You can add as many locations as you like to PATH. However, convention and best practice dictate that you try to avoid cluttering up your PATH with unnecessary executables.
The Android Debug Bridge (ADB) is an important command-line tool for controlling your Android device from your computer. With ADB you can perform many useful commands to back-up your data, sideload .zip files you would otherwise flash in custom recovery, unlock your bootloader on Nexus devices, and several other uses for debugging your Android phone.
Installing ADB on a Windows machine is a fairly painless but involved process. This guide will walk you from start to finish.
- Go to the Android SDK website and navigate to “SDK Tools Only”. Download the version for your platform.
Download SDK Tools - Open the SDKManager.Exe and choose only the “Android SDK Platform Tools” for installation. If you’re on a Nexus phone, you should also choose “Google USB Driver”. When you click Install, it will begin downloading the necessary files to your computer.
Downloading Android SDK Platform Tools - Enable USB debugging on your device. ADB will only work on your device when USB debugging is enabled. USB debugging is usually found under Developer Options, so if you have not enabled Developer Options yet, go to Settings>About Phone> tap on “Build Number” 7 times, and you will get an alert that Developer Options are enabled. You can now go into the Developer Options to turn on USB Debugging.
Allow USB Debugging - Navigate to the folder on your PC where the SDK tools were installed. Shift + Right Click on the folder and select “Open Command Window Here”.
- Connect your Android phone to your computer via USB (Make sure that you are using Data cable, not the charging cable). If you are prompted on your device, then choose “file transfer (MTP)” mode. Now in the command terminal type:
adb devices
It should display your device as being connected. If there is no device shown in the command prompt, you may need to download USB drivers specific to your phone from the manufacturer’s website.
You should now configure your system-path so you can always run ADB commands from inside the command terminal without having to run it from the SDK tools folder. The methods are nearly the same but a little different between Windows 7, 8, and 10.
Add ADB to System Path for Windows 7, 8
- Go to Control Panel > System > Security and click the “Advanced System Settings” button, then click on “Environment Variables”.
Edit Environment Variables - Find the variable called “Path” on it to highlight, then click “Edit“.
Edit Path of Environment Variables - Add your ADB folder to the end of the variable value, with no spaces, preceded by a semicolon. For example:
;C:\Android\platform-tools
Add ADB to System Path in Windows 10
Follow the steps above until 3. Instead of adding the string to a pre-existing variable string, you are simply going to click “Add New” in the environment variable box that opens. Simply add your ADB folder and press enter.
List of Useful ADB Commands
- adb install C:\package.apk – Install an .apk package from your C:\ to your Android device.
- adb uninstall package.name – Uninstall an app package from your device – package name would be the specific app package name as seen in your device, for example, com.facebook.katana
- adb push C:\file /sdcard/file – Copies a file from your C:\ to your devices SD card.
- adb pull /sdcard/file C:\file – The reverse of ADB push.
- adb logcat – View the log from your Android device.
- adb shell – This will open an interactive Linux command line on your device.
- adb shell command – This will run a command on your device’s command line.
- adb reboot – This will reboot your device.
- adb reboot-bootloader – Reboots your device to the bootloader.
- adb reboot recovery – Reboots your device to recovery.
fastboot devices – ADB commands only work once your phone is fully booted, not from the bootloader. FastBoot allows you to push ADB commands to your device from the bootloader, useful for when you’re stuck in a recovery loop, for example.
Kevin Arrows
Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.