How to Use ADB or Fastboot From Any Directory on your Windows/Linux PC

How to Use ADB or Fastboot From Any Directory on your Windows/Linux PC

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


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.


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.

Discuss This Story

You might also like