User vs. System Environment Variables: Do User Variables Override System Variables

There are some programs and commands in Windows which it finds magically without the user giving any hint of where it is placed in the filesystem. For example, if we have to run the PING command, we don’t have to give the location of ping.exe to run it. We just write ping and Windows does the rest of the job. Some executables are known to Windows by default. These paths are configured using Windows system and user variables.

Windows system variables and user environment variables 1
Windows system variables and user environment variables

An environment variable is a dynamic value which points to different environments (folders) of the system. For example, if you install Java, you will need to manually set Java environment variable to make sure you can run Java commands without entering path of each command again and again.

There are two types of environment variables:

  1. System environment variables
  2. User environment variables

Some examples of environment variable that are used most often are:

  • “%windir%”
    WINDIR takes you to the directory where Windows is installed.
  • “TEMP”
    TEMP is a command that takes you the folder where temporary files are stored.
  • “PATH”
    PATH environment variable is the most widely used command that contains the executable files and these can be executed from command prompt directly.

The default contents of each variable depends on the version of Windows you are running.

You can access the environment variable settings in Windows by following the steps below:

  1. Go to Run –> systempropertiesadvanced. This will open System Properties window (Advanced Tab)
  2. Click Environment Variables button
  3. There are two sections on the next window, User variables and System variables.
  4. Select any defined variable in the variables section and click edit.

First we will understand both types of these variables and then how they relate or differentiate. So let’s begin.

System Environment Variables

As the name suggests it deals with the environment of your computer or in more technical terms, the Operating System i.e. an environment the operating system provides the user to execute or perform various operations. So system environment variables provide the variables or values stored in the variables that are required by the system to let other applications perform their tasks. By accessing these variables provided by the system you can get essential information about the system that could be helpful in many ways either to perform a task or to run some kind of program on the system.

System Environment variables are those defined by system and are globally used by all users.

So these were some of the environment variables that store these commands and which are used commonly. You can even create some system variables if you are the admin of the system.

User Environment variables

User variables are only used by the user who declared that variable.

Users can create variables of their choice and insert in it the values that they desire. You can create your own “path” variable or you can even store a string in that variable. You can access the user variables by simply typing the variable in ‘Run'(windows key+R) and it may take you to the path of the user defined variable. But you need to remember that you can not provide the path of any other user’s account as user variables are only accessible by the user who makes them.

Do User Variables Override System Variables?

User variables override the system Variables even if the variables are named the same.

If a user defines a variable that has the same name as a system variable, then when that particular user calls that variable it accesses the local variable made by the user and not the system variable. But this is only in the case of the user who defined it, if any other user access these variables it will call the system variable by default.

However there is a slight difference in ‘PATH’ system variable, the user defined ‘path’ variable does not completely replace it. In fact, it appends with the system ‘PATH’ variable.

If you liked this post, Share it on:
Itechtics staff is a team of technology experts led by Usman Khurshid. We verify everything we write so that our users can be sure to trust us in everything we write. You can reach out to us for further help and support.

2 comments

  • Renju Jose
    Renju Jose

    Nicely explained. Thanks for the article.

    Although, one question.
    “However there is a slight difference in ‘PATH’ system variable, the user defined ‘path’ variable does not completely replace it. In fact, it appends with the system ‘PATH’ variable.”

    Does the system PATH variable value come in the beginning of user PATH variable or at the end?

    • Usman Khurshid
      A
      Usman Khurshid

      User variables are read first and then the system variables. If there is a conflict, the user-defined variable will be selected.

Leave your comment

Get Updates in Your Inbox

Sign up for the regular updates and be the first to know about the latest tech information