Environment variables are global settings that are used to configure programs on your computer. They’re really just a shared configuration store for different apps to hook into, despite the fact that they sound technical. How to Set Environment Variables in Windows 10/11?
How to set an environment variable in Windows 10
Individual user accounts are linked to environment variables, so different users can have different configurations. There are also global system variables, such as “%windir%”, which always points to the directory where Windows is installed (e.g. “C:Windows”). Instead of hardcoding this value, apps can instead reference “%windir%” when they need to access the Windows directory.
After installation, many apps add their own environment variables. To view and edit your environment variables, go to the Start menu and type “edit environment variables” into the search box.
You can see all of the environment variables that have been set on your machine in this section. The “OneDrive” variable in the example above points to the current user’s OneDrive storage directory; if you change the OneDrive directory from the OneDrive system tray, this value will update.
Because OneDrive is an environment variable, programs can get the location of your OneDrive directory using “%OneDrive%” in paths. You can even try it out for yourself: press Win+R to open the Run prompt, then type “%OneDrive% ” to access your OneDrive folder.
Select an environment variable from the list and click “Edit” to make changes. Change the variable’s name and value using the popup prompt. However, be cautious when editing variables that you didn’t create; an incorrect value could cause a program or the entire system to fail.
Similarly, creating a new variable is as simple as clicking the “New” button and entering the name and value. Keep in mind, however, that environment variables have no effect on their own. Your variable will have no effect because no program will use it. However, you can get the value of your environment variable using the Command Prompt – launch it from the Start menu and type “echo %<myvariable>%”, replacing “<myvariable>” with your variable’s name, to see its value displayed.
People also ask