Environment variables are user variables or Windows system variables that describe the environment in which apps run. They can tell your apps things like the name of the computer, the name of the user account, the current working directory, etc. Do you want to know more about how to use environment user variables and Windows system variables? If you do, read this tutorial and learn how to create environment variables in Windows 10. There are some situations in which knowing how to do that can prove very useful.
NOTE: To create user variables and Windows system variables, you have to access the Environment Variables window. If you don’t know how to do that, a quick way to do it is by executing the command “rundll32.exe sysdm.cpl,EditEnvironmentVariables” in the Run window (Win + R). However, there are other ways to open it, which we covered in this guide: What are Environment Variables in Windows?.
User environment variables are available only to your user account. When creating such variables, their values should include paths towards locations that are accessible to your user account. For example, you can’t have your user variable point to a personal folder of another user account (like Documents, Pictures, Music, etc.). In the “User variables for [user account]” section, click or tap New.
The “New User Variable” window opens. Start by typing the name of the variable you want to create (1). Make it something suggestive so that you can easily remember its purpose. Then, type its value (2).
The value may include a path or more. A path can point to a folder or a file. You can also use other existing variables to build up the path you want. For example, you can use a value like %Userprofile%Desktop to point the variable to your user account’s Desktop. If you want it to have more than one value, separate the values with semicolons (;) — for example, Path 1; Path 2; Path 3.
NOTE: It is not mandatory to use only paths to folders and files as values for user variables. Depending on what you want to do with the variable you create, you can also store strings of text as its value.
When you are done setting the user variable, click or tap OK. The new variable is added to the list of user variables, but it is not yet created, so you can’t use it at this time.
For the new environment variable to be created, in the Environment Variables window, click or tap OK.
To test if the user variable was created successfully and that it points to what you want, open a Run window (Windows + R). Type the name of the environment variable you just created, between percent (%) signs. For example, to execute the digitalcitizen variable we just created, we had to type %digitalcitizen%. Then, we pressed OK. In our case, it opened the digitalcitizen folder found in our user’s Documents.
IMPORTANT: Any user can add, change, or delete user environment variables. User variables can be created by Windows 10, apps, and users alike.
The process for creating system variables is the same as for creating user variables. To make sure you get it right, let’s go through another quick example.
In the System variables section, click or tap New.
The New System Variable window opens. Enter the name of the variable (1) and its value (2). Note that you can add multiple values to a variable – all you need to do is separate them with semicolons (;).
IMPORTANT: If you specify a path as a value for a system variable, that path should be accessible to all user accounts. If that path points to a location where only one user account has access, you should create a user variable instead of a system variable.
When you are done customizing the new system variable, click or tap OK. The new variable is added to the list of system variables, but it is not yet created.
In the Environment Variables window, click or tap OK so that the new environment variable is created.
To test if the user variable was created successfully, open Run (Windows + R) and insert the name of the environment system variable you created, between percent (%) signs. For example, to run the Games variable that we created, we had to type %Games%. Then, we pressed OK.
Windows opened the Games folder where all games are installed on our Windows 10 test computer. All users have access to this folder, and they can use this variable to access those games quickly.
IMPORTANT: Are you wondering whether any user can add system environment variables or change existing ones’ values? The answer is NO! Only administrators can perform these actions. Standard users don’t have enough clearance to make or change Windows system variables because they affect every user and every app on the PC. This tutorial provides more details about standard and Administrator accounts.
The process involved in creating environment variables in Windows 10 is not that complicated. However, before you get the hang of it, you should experiment first by making a couple of safe user variables that don’t negatively impact the system’s functioning.