The environment variable (environments) in Windows stores information on the settings of the OS and user data. It is denoted by the "%" pair symbol, for example:
% Username%
With these variables, you can transmit the necessary information to the operating system. For example,% Path% stores the list of directories in which Windows is looking for executable files if the path to them is not specifically specified. % Temp% stores temporary files, and% APPDATA% - user program settings.
Why edit variables
Changing environment variables can help if you want to transfer the TEMP or AppData folder to another place. Editing% Path% will give the ability to run programs from the "command line" without specifying every time a long path to the file. Let's consider the methods that will help in achieving these goals.Method 1: Computer Properties
As an example, the program you want to run, use Skype. Having tried to activate this application from the "Command Line", you will get such a mistake:
This is because you did not specify the full path to the executable file. In our case, the full way looks like this:
"C: \ Program Files (x86) \ Skype \ Phone \ Skype.exe"
To repeat it every time, let's add Skype directory into a variable% path%.
- In the "Start" menu, right-click on the "Computer" and select "Properties".
- Then go to "Advanced System Parameters".
- On the Optional tab, click on "Wednesday Variables".
- A window with various variables will open. Select "PATH" and click "Change".
- Now you need to finish the path to our directory.
The path must be specified not to the file itself, but to the folder in which it is located. Please note that the separator between directories is ";".
We add the way:
C: \ Program Files (x86) \ Skype \ Phone
And click "OK".
- If necessary, in the same way we make changes to other variables and click "OK".
- Complete the user session so that the changes are preserved in the system. Go back to the "Command Line" and try to run Skype by typing
Skype.
Ready! Now you can run any program, not just Skype, being in any directory in the "Command line".
Method 2: "Command Line"
Consider the case when we want to set% APPDATA% to the "D" disk. This variable is absent in "environment variables", so it cannot be changed in the first way.
- To find out the current value of the variable, in the "command prompt", enter:
- To change its value, enter:
- Check the current value of the% APPDATA% by entering:
Echo% AppData%
In our case, this folder is located at:
C: \ Users \ Nastya \ APPDATA \ Roaming
Set AppData = D: \ APPDATA
Attention! Make sure you know exactly why you do it, because rampant actions can lead to WINDOVS inoperability.
Echo% AppData%
The value is successfully changed.
Changing the values of environment variables requires certain knowledge in this area. Do not play with the values and do not edit them at random, so as not to harm the OS. Well study theoretical material, and only after that go to practice.