How do I add a path to the %PATH% environment variable on Windows?

How do I add something to a path (PATH or system PATH)? What is %PATH% and %something%?

Here are some examples:

  1. Add the following string to the PATH, C:\Program Files (x86)\CMake 2.8\bin.

  2. Do you have make in your %PATH% environment variable? On my system, I need to add %MINGW_DIR%\bin to %PATH%.

  3. Add C:<Qt_directory>/mingw/bin to the system PATH.

I understand that you need to go to System Properties → Advanced → Environment variables...

And then, if we are talking about PATH, then add "User environment variables of such and such", and if system PATH, then "System variables".

Then you need to click "Create". What should I write in the "Variable Name"? In the value of the variable, you need to write the lines that are given in the instruction, right?

Qt\_\_directory - this is probably the path to the Qt folder. Between the two % also the path to the folder? %PATH% and %MINGW_DIR% are the same thing if PATH is understood as a path to MinGW?

Author: jfs, 2012-10-14

1 answers

Yes, that's right, you need to go to System Properties → Advanced → Environment Variables. There will already be PATH variables. One is for the current user, and the other is system-wide. Just click on them and add the desired path separated by a semicolon.

Screen shot of the "Environment Variables" dialog in the mode of editing the PATH environment variable

Alternatively, you can write a command script that changes the environment variable. At the same time, it can change globally for the entire system, the current session, and within a specific command line the shell in which this command script is run. See the article "Update Windows Path Environment Variable " for details"[archive].

 10
Author: gecube, 2016-10-23 11:35:57