In Linux, the PATHenvironment variable stores the names of paths that will be searched for the executable files of any commands typed in the command line. The value of the PATH environment variable is a string containing a series of pathnames, each delimited by a colon. For instance, the default PATH on a typical system might look like this:
![Add Add](/uploads/1/2/3/7/123714636/512267115.png)
When you type in a command such as cat at the command prompt, your shell will look in each of these directories for an executable file named cat. The first one it finds is the one it runs.
To view the current value of your PATH environment variable, you can use the echo command. As with all variables in the shell, when referring to the value you need to put a dollar sign before the variable name:
In the above example, the current value of path return you to the command prompt.
Setting PATH for your current shell session
You can set the value of PATH as you would any other shell variable, with the form NAME=VALUE, like this:
The problem with this command is that it will completely overwrite the values you had before, which you probably don't want. If you want to add a new value in addition to the old ones. You can accomplish this by referring to PATH in the new definition, like this:
Using the command above adds your new path to the current value of PATH. Since the pathnames are searched in order, you probably want to add your new path at the end of the variable as we've done here. Instead, if you typed:
Your new path would be searched before, not after, the default system paths.
Using export to pass the PATH environment variable to child processes
This type of PATH definition will set the environment variable for your current shell session, but any new programs you run might not see the new path you've added. That's because your shell lets you control the environment by requiring you to manually declare what environment variables are passed on to other programs and processes. You can accomplished this with the export command. If you run:
Any processes you run until you log out will use the current value of PATH.
If you prefer, you can combine these two commands into a single line, for convenience. Put a semicolon between them so that the shell knows they're separate commands:
Tip
If any of your pathnames have spaces in them, you should enclose the variable definition in quotation marks, to be safe:
Setting the PATH variable for every new shell session
The methods we've used so far only sets the environment variable for your current shell session; when you logout or close the terminal window, your changes will be forgotten. If you want to set PATH to a certain value every time you log in or start a new shell session, you should add it to your bash startup script. Every time you start an interactive shell session, bash reads the following files in order (if they exist), and executes the commands inside of them:
/etc/profile
~/.bash_profile
~/.bash_login
~/.profile
~/.bash_profile
~/.bash_login
~/.profile
The first file, /etc/profile, is the default startup script for every user on the system. One or more of the remaining three files are located in the home directory of every user. Any of those three can be used, but it's important to know that they will be searched for in this order.
You can edit these files and manually change any lines containing PATH= definitions. Be careful if you do so, because these are the directories used to locate important operating system files.
If all you want to do is add a path for your current user, you can leave the other PATH= lines untouched, and add a line like this to the end of the file:
If you add this to the end of the .bash_profile file in your home directory, it takes effect every time your user starts a new shell session. If you add this to /etc/profile, it takes effect for every user on the system. Note that you need administrator privileges if you want to edit /etc/profile, so you can use sudo (or be logged in as root) to do so.
Additional information
- [Instructor] When you install the Java Development Kit…on Windows, the Java command,…that is the Runtime Environment,…is added to your system path automatically,…but the compiler isn't.…I'm going to type javac, that's the name…of the compiler command, -version,…and I'll get a Windows error message.…The nature of the error message will differ,…depending on whether you're working in PowerShell,…as I am, or the standard command prompt.…But either way, this is telling you…that the compiler can't be found.…
To fix that, I'll go to my control panel.…On Windows 10 I do that by going to the Start menu,…and starting to type control panel,…and then selecting it.…Then I'll click into the search box…and start typing the word environment.…I'll click Edit environment variables for your account,…and then I'll double click on the path variable.…If it doesn't exist, I'll create it.…My job is to add the location of my bin directory,…that's the directory that contains the Java commands.…
You can find it under C:Program FilesJava.…
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.
What Is the Windows System PATH?
![Add To Path Windows Add To Path Windows](/uploads/1/2/3/7/123714636/871593079.png)
If you’ve downloaded a program for the Command Prompt–like ADB, the Android Debugging Bridge–you can’t just type
adb
in the Command Prompt 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:
That’s a lot of typing, though, especially for something you have to run often.
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:WindowsSystem32
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 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:
No extra typing necessary.
How to Add a Folder to Your PATH
RELATED:How to Install and Use ADB, the Android Debug Bridge Utility
The first several steps of the process are the same for Windows 7, 8, and 10. Start by pressing the Windows key to open up the Start Menu or Start Screen, 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.
This is where things are different between the versions of Windows—it’s the same for 7 and 8, but slightly different (and easier) in Windows 10.
In Windows 7 and 8
In 7 and 8, the variable value for Path is nothing more than a long string of text with various locations around the system. We’ve put the ADB executables in
C:Androidplatform-tools
on our machine, so that’s the location we’re going to add.
In order to add an entry to your path in Windows 7 and 8, you have to precede the folder with a semicolon, like so:
Add that exact line at the end of the variable value (make sure not to delete any of the existing text in the value!) without a space. Click OK, and you’re done. Simple.
In Windows 10
In Windows 10, this process is both easier and less confusing. 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:Androidplatform-tools
in our example—and hit Enter. There is no need to add a semicolon like in Windows 7 and 8. Click the “OK” button and you’re finished.
The Android Debugging Bridge should now be accessible from any command prompt, no need to specify its directory.
READ NEXT
- › How to Set Up a Smart Kitchen
- › How to Speed Up Your PlayStation 4’s Downloads
- › How to Disable the Login Screen’s Background Blur on Windows 10
- › How to Use All Linux’s Search Commands
- › How to See All Your Saved Wi-Fi Passwords on Windows 10
FFmpeg is one of the most popular, free, and open-source software that supports converting almost any multimedia format to any multimedia format. For instance, you can use it to convert videos from one format to the other, convert or split audio files, download HLS videos, etc. The best thing about FFmpeg is that you can do most of the things with single line commands.
Simply put, FFmpeg is awesome and every user should have FFmpeg installed.
In this quick guide, let me show you how to download and properly install FFmpeg on Windows 10. When I say 'install,' I'm talking about adding FFmpeg to Windows path so that it is easier to access. Let's get started.
Add To Path Windows Xp
I've also added a video tutorial at the end if you want to see the procedure. Click on the jump link below to go to the video tutorial.
Jump to:
- Add FFmpeg to Windows 10 Path
Install FFmpeg on Windows 10
FFmpeg is a simple and powerful software that is also portable. So, in theory, you don't have to install FFmpeg to use the software. However, being a command line tool, you have to manually navigate to the FFmpeg folder from within the Command Prompt or PowerShell to access the ffmpeg.exe file to execute relevant commands.
This is generally not a problem. But it is not that user-friendly either. To deal with that, all you have to do is add FFmpeg to Windows 10 Path using Environment Variables. Once added, you can access FFmpeg from Command Prompt or PowerShell from any folder or directory.
Here's how to do it.
Download FFmpeg for Windows 10
Note: The same procedure can be used in Windows 7 and 8. All be it the user interface may differ a bit. But it is not that much of a difference. So, it should be good.
1. To start off, head over to the official FFmpeg website and download the current stable build.
2. Once downloaded, extract the FFmpeg to the folder or drive of your choice. Rename the extracted folder to ffmpeg for ease of access. In my case, I extracted it to the root of C drive.
Add FFmpeg to Windows 10 Path
3. To add FFmpeg to Windows 10 path, search for 'Edit the system environment variables' and open it.
4. Click on 'Environment Variables' appearing at the bottom window.
5. Select 'Path' variable and click 'Edit.'
6. Click 'New.'
7. Here, enter 'C:ffmpegbin' and click on the 'Ok' button. If you've placed the FFmpeg folder in other drive or folder then change the directory path accordingly.
Note: On Windows 7 and 8, add the directory path at the end and add
;
to the end of the directory path. It should look something like this C:ffmpegbin;
.
8. This is how it looks like in the main Environment Variables window. Click on the 'Ok' button to save changes.
9. That's it. Close the main window and you are good to go.
Add FFmpeg to Windows 7/8 Path
The procedue the add FFmpeg to Windows 7 path is similar but the user interface is a bit different. Let me show you how to do it.
1. Follow steps 3 and 4 to open Enviroment Variables.
2. Under System Variables, scroll down, select 'Path' variable and select the option 'Edit.'
3. In the Edit System Variable window, go to the end of the line in the Variable Path field and add ';C:ffmpegbin' and click on the 'Ok' button to save changes.
Each path you add in the value field should be separated by ;. That the reason why I added ; in the folder path. If you've stored FFmpeg in some other field then change the folder path accordingly.
Verify FFmpeg Path
To check whether FFmpeg is properly added to Windows path, open the Command Prompt or PowerShell, type
ffmpeg
and press enter. If everything goes well, you will see FFmpeg details like the version number, default configuration, etc.
Quick tip: how to always open Command Prompt as admin on Windows
Video Tutorial
That's all there is and it is that simple to add FFmpeg to Windows path. Comment below sharing your thoughts and experiences about using the above method to install FFmpeg on Windows 10.
Today I will explain how to add your PHP runtime directory to your Windows 10
PATH
environment variable.This will give you global access to php.exe
from any command prompt.
Please note that you must reopen your command prompt windows (if you had any open prior to the update).
Command prompt loads the
PATH
environment variable when it is first open.
Target audience
- Windows 10 users
- PHP developers that want PHP to be globally accessible from any command prompt (ex.: php.exe for “linting” or to start a dev. server)
Note that you are not limited to PHP, this can be any directory containing any program - ex.:
npm
How to
Copy shortcut:
ctrl+C
Paste shortcut: ctrl+V
- Find your PHP installation directory and copy it somewhere (your clipboard is a good place)
- For MAMP users it will be something like
C:MAMPbinphpphp5.6.21
(the PHP version may vary).
- For MAMP users it will be something like
- Right-click on the “Start menu”
- Click “System”
- Click “Advanced system settings”
- Click “Environment Variables…”
- Select the “Path” variable (in your user or in the system list)
- Click “Edit…”
- Click “New”
- Paste your PHP path
- Click OK
- Click OK
- Click OK
- Close your “system window”
And voilà!
How to test if it worked out
- Open a command prompt
- Right-click on the start menu
- Click “Command Prompt” or “Command Prompt (admin)”
- In the command prompt, type
php -?
Add To Path Windows Batch File
If it displays PHP help then it worked!