CodeSteps

Python, C, C++, C#, PowerShell, Android, Visual C++, Java ...

How to set PATH environment variable in Windows?

Two ways we can set the PATH environment variable. One is through command prompt and other way is through System properties window. Keep that in mind that, when you set the PATH environment variable through command prompt, it will be available to that particular command prompt window. If you set the PATH environment variable through System properties window, it will be available all the time until you delete the PATH environment variable.

Applications will look into this environment variable to look for necessary files.

Set PATH environment variable from command prompt in Windows

Step (1). Open command prompt window.

Step (2). At the command prompt type the following command:

set PATH=%PATH%;add-path

Here add-path is the new path you want to add to the PATH environment variable. Keep that in mind with the above command we are not resetting the PATH environment variable; instead we are adding additional path to the PATH environment variable, so that we will not lose the previous paths in the PATH environment variable.

Set PATH environment variable from System properties window

Step (1). Open System properties window. You can open System Properties window by right click on Computer icon and select properties from the pop-up menu.

Step (2). Click on Advanced tab. (If you are using Windows 7, click on Advanced system settings item from left side items)

Step (3). Click on Environment Variables… button. It will open Environment Variables window and display both User environment variables and System environment variables. User Environment variables are specific to the users who created them. System Environment Variables are available to all users.

Step (4). Look for PATH environment variable in User variables & System variables.

Step (5). If PATH environment variable doesn’t exist; click on New… button. If you want to create User Environment Variable, click on New… button which is under User variables. Otherwise click on New… button which is under System variables section. It will open New Variable window.

Step (5a). Under Variable name: field enter “PATH” (don’t include double quotes).

Step (5b). Under Variable value: filed enter the folder path you want to add to PATH environment variable. If you want to add multiple paths, separate them by semi-colon (‘;‘).

Step (5c). Once you made the changes, click on OK button.

Step (6). If PATH environment variable exists; click on Edit… button. It will open Edit Variable window.

Step (6a). Under Variable value: filed enter the folder path you want to add to PATH environment variable. If you want to add multiple paths, separate them by semi-colon (‘;‘).

Step (6b). Once you made the changes, click on OK button.

Once you added/updated the PATH environment variable, click on OK button on Environment variables window. Click on OK on System Properties window to close the System Properties window.

Now the PATH environment variable is set. If you want to see whether the changes are affected or not by typing the following command at the command prompt.

path

The above command will displays the search path for executable files.

How to set PATH environment variable in Windows?

2 thoughts on “How to set PATH environment variable in Windows?

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top