What are System and User Variables in Windows

There are some settings in Windows that for ordinary everyday users are quite complex. But as long as we deepen our knowledge and look for specialized prethe, so we have great chances of falling on them. Like System and User Environment Variables.

What is it and what do they do?

variables 4

In this article we will discuss environment variables, system and user variables and how to add and modify them. Next, we will go to the dynamic system variables and see how to use them in the command line. So tie up, the flight begins.

What is an Environment Variable

The Environment Variable ) is what these two words literally mean. It is a variable in a particular environment. That is, it is a value that can changed and which differs from computer to computer.

Windows provides one environment for applications, which will install themselves in this environment and perform operations and that is what makes the second word. Combining both of these words, environment variables are those objects that store values ​​provided by the environment.

In short, we say that the environment provides values ​​that help other programs obtain some critical information about the system. And when we say prices we are not talking about numbers and figures but about alphanumerics .

Like for example the environment variable called 'windir' which corresponds to the directory where Windows is installed. To understand what this environment variable does, open an explorer window and type %windir% in the address bar. It will take you directly to the Windows installation folder.

So having the variable windir as the folder path where Windows is installed gives third-party programmers the right to use windir whenever they want to go there, without having to know if your Windows is installed on disk. C: or D: or in the C: / Windows folder or in the F: / Mitsos folder.

There are many other variables that can be accessed by anyone, such as "TEMP" or "TMP" which is the variable that shows the directory where all temporary files are stored. The most popular variable that has to do with a path to your disk is "PATH" and it is the one that shows the directories that contain executable files.

To be able to run a program from the Command Prompt (Command ) from any directory, this program should have the executable .exe file in the Path variable. That is, you install a programming language, let's say python. In order to be able to run a python command from anywhere on the command line, the Path must have, among other things, the physical path where the program is stored.

All of these variables come in very handy when you're developing something or using it very.

What are System Variables and what are User Variables?

Very similar to how the registry works in Windows, we also have the System Variables (System variables) and User Variables (System variables). System variables are system-wide and do not differ from user to user. While User Variables are configured differently from user to user. You can add your variables below each user so that they are not affected by other users using the same computer.

User Variables have more value than System Variables. So if there are user variables with the same with system variables, then user variables will be considered. Except for the Path variable which works in a different way. The User Path Variable is appended to the System Variable. So the order of entries will be system entries followed by user entries.

How to add and modify environment variables

A little warning before we go deeper. Create a system restore point and try not to violate existing settings that have been made for your system. Until you are sure of your actions. To open the Environment Variables window, follow these steps:

1. Open Settings> System> Info.
2. On the right, select "Advanced System Settings".


3. In the "System Properties" window that will open and on the "Advanced" tab, click the "Environment Variables" button that is low.

A new window with environment variables will open showing you the user and system variables separately.

variables 1

The variable is in the first column and its value in the second. The corresponding buttons below the table allow you to add, edit and delete these variables.

variables 2

When a variable has many values ​​you must click edit to see all of these values.

Using the Path variable

Path is the most widely used environment variable. As mentioned, it shows the directories that contain executable files. Once you have properly configured the Path variable, you can use these executables from anywhere in the system. Let's try to understand it with an example. Open the Environment Variables window and look for the "Path" in the system variables.

Click 'Edit' and then click 'Create' without playing with any other controls yet. Now click on “Browse” to browse and select a folder that has the desired executable file. Click the “Ok” button and save everything.

Now you can run your application from wherever you are and for example open the command prompt and enter the name of the executable file that was in the folder. You can provide additional switches and settings if the program supports it. The program will run from the command line without even being in the directory where the command is located. This is the beauty of the Path variable.

List of all environment variables

Open the command prompt and type set and press Enter. The full list of variables with their current values ​​will be displayed and you can refer to whichever you want to make changes to your computer.

cmd set

Of course you can see the variables one by one, from the Environment Variables window we mentioned earlier, but with the command line things are more concentrated. Anyway, whatever suits you.

Dynamic Environmental Variables

Unlike conventional variables, dynamic environment variables are provided by CMD and not by the system. That is, they are internal variables of cmd.exe and therefore are used only with the command line. Dynamic variables are not available in other executable files or scripts, as these variables are not essentially environment variables.

You can not change the values ​​of these variables and they extend to different values ​​every time a question is asked. Even the SET command does not reveal these variables.

Some of the dynamic environment variables are:

%CD%: Typing in this command will give you the current directory in which you work.
%DATE%: This variable will give you the current date according to the date format preferences.
%TIME%: Similarly, it gives you the current time according to the time format preferences.
%RANDOM%: This variable prints a random number between 0 and 32767 (type echo% random% on the command line and you will see).
%ERRORLEVEL%: Specifies the level specified by the last execution command.
%CMDEXTVERSION%: This variable indicates the version of the command line extensions.
%CMDCMDLINE%: Shows the path of their cmd.exe utility

That was pretty much the basics of system variables and user variables in Windows. Windows comes with a lot more variables, so don't forget to check them using the 'SET' command.

iGuRu.gr The Best Technology Site in Greecefgns

enviroment, Windows, Dynamic, cmd, variables

Written by Dimitris

Dimitris hates on Mondays .....


Leave a Reply
    • Thanks for the reply. It is our pleasure to see comments that supplement or correct our articles.
      It would be to the benefit of all readers, but also of the authors, if you continued your reasoning and mentioned additional benefits and uses of the path.

Leave a reply

Your email address is not published. Required fields are mentioned with *

Your message will not be published if:
1. Contains insulting, defamatory, racist, offensive or inappropriate comments.
2. Causes harm to minors.
3. It interferes with the privacy and individual and social rights of other users.
4. Advertises products or services or websites.
5. Contains personal information (address, phone, etc.).