What are System and User Variables in Windows

There are some setups in Windows that are quite complicated for ordinary everyday users. But the more we deepen our knowledge and look for specialized programs, the more chances we have to fall on them. Such as System Environment and User Variables.

What is it and what do they do?

variables 4

In this article we will discuss about environment variables, system and user variables and how to add and modify them. Next, we'll move on to dynamic system variables and see how to use them in of commands. So strap in, the flight begins.

What is an Environment Variable

Environment Variables is what these two words literally say. It is a variable in a specific environment. That 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 to obtain some critical information about the system. And when we say values ​​we are not talking about numbers but about alphanumeric elements.

Όπως για παράδειγμα η μεταβλητή περιβάλλοντος που ονομάζεται 'windir' που αντιστοιχεί στον κατάλογο όπου είναι εγκατεστημένα τα Windows. Για να καταλάβετε τι κάνει αυτή η μεταβλητή περιβάλλοντος, ανοίξτε ένα παράθυρο της εξερεύνησης και πληκτρολογήστε %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.

Υπάρχουν πολλές άλλες μεταβλητές (variables) που μπορούν να αποκτήσουν πρόσβαση όσοι θέλουν, όπως το "TEMP" ή το "TMP" η οποία είναι η μεταβλητή που δείχνει τον κατάλογο όπου αποθηκεύονται όλα τα προσωρινά αρχεία. Η πιο δημοφιλής μεταβλητή που έχει να κάνει με μία διαδρομή στο δίσκο σας είναι η "PATH" και είναι αυτή που δείχνει τους καταλόγους που περιέχουν εκτελέσιμα αρχεία.

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

All of these variables come in very handy when you're developing something or te the shell too.

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 a higher value than System Variables. So if there are user variables with the same name as the system variables, then the user variables will be taken into account. Except for the Path variable which works differently. The Path User Variable is attached to the System Variable. Thus, the order of entries will be the system entries followed by user entries.

How to add and modify environment variables

Μια μικρή προειδοποίηση προτού πάμε βαθύτερα. Δημιουργήστε ένα σημείο επαναφοράς συστήματος και προσπαθήστε να μην παραβιάσετε τις υπάρχουσες ρυθμίσεις που έχουν φτιαχτεί για το σύστημά σας. Μέχρι να είστε σίγουροι για τις ενέργειές σας. Για να ανοίξετε το παράθυρο "Μεταβλητές περιβάλλοντος", ακολουθήστε τα εξής βήματα:

1. Open Settings> System> Info.
2. Εκεί στα δεξιά επιλέξτε "Ρυθμίσεις συστήματος για προχωρημένους".

variables

3. Στο παράθυρο "Ιδιότητες Συστήματος" που θα ανοίξει και στην "Για προχωρημένους" κάντε κλικ στο κουμπί "Μεταβλητές περιβάλλοντος" που είναι χαμηλά.

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

variables 1

The variable name is in the first column and its value is 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
Η Path είναι η πιο χρησιμοποιούμενη μεταβλητή περιβάλλοντος. Όπως αναφέραμε, δείχνει τους καταλόγους που περιέχουν εκτελέσιμα αρχεία. Αφού ρυθμίσετε σωστά τη μεταβλητή Path, μπορείτε να χρησιμοποιήσετε αυτά τα εκτελέσιμα από οπουδήποτε στο σύστημα. Ας προσπαθήσουμε να το καταλάβουμε με ένα παράδειγμα. Ανοίξτε το παράθυρο μεταβλητών περιβάλλοντος και αναζητήστε το "Path" στις μεταβλητές του συστήματος.

Κάντε κλικ στο 'Επεξεργασία' και, στη συνέχεια, κάντε κλικ στο 'Δημιουργία' χωρίς να παίζετε με άλλα στοιχεία ελέγχου ακόμα. Τώρα κάντε κλικ στην "Αναζήτηση" για να περιηγηθείτε και να επιλέξτε ένα φάκελο που έχει το επιθυμητό εκτελέσιμο αρχείο. Κάντε κλικ στο κουμπί "Ok" και αποθηκεύστε τα πάντα.

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 error level set 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

Αυτό ήταν ας πούμε τα βασικότερα σχετικά με τις μεταβλητές συστήματος και μεταβλητές χρήστη στα Windows. Τα Windows έρχονται με πολύ περισσότερες μεταβλητές, γιαυτό μην ξεχάσετε να τις ελέγξετε χρησιμοποιώντας την εντολή 'SET'.

iGuRu.gr The Best Technology Site in Greecefgns

every publication, directly to your inbox

Join the 2.087 registrants.
enviroment, Windows, Dynamic, cmd, variables

Written by Dimitris

Dimitris hates on Mondays .....

2 Comments

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.).