How to Set Environment Variables in Windows 10
Windows 10 has been on the market since 2015, but the Windows OS family has a much longer history. In fact, Windows happens to be one of the oldest operating systems still in use today, thanks to Microsoft’s domination of the PC market in the 1990s with Windows 3.1, Windows 95, Windows 98, and Windows NT (used mostly for servers but also for the desktop).
Along the way, a number of versions of Windows did very well, particularly Windows XP, Windows 7, and of course, Windows 10. The popularity has kept the OS alive even as the computing world has changed radically, and the age of the lineage means that the operating system has a wealth of legacy features that the most modern versions still support.
One of those legacy features and one that is still in use today (and a useful feature it is, too) is the environment variable. Environment variables have been a powerful feature of Windows from the earliest days; in fact, they predate Windows and derive from MS-DOS.
Despite their age, environment variables are a useful way to control the way Windows operates with an extremely small footprint in terms of memory usage. For example, one common environment variable is called PATH, which is simply an ordered text string containing a list of directories that Windows should look in when an executable file is invoked.
The PATH environment variable allows users to quickly launch utility programs or other programs without having to know (or care) where those programs live on the hard drive. Setting environment variables is very simple. In this article, I will provide you with information on how to find and set your environment variables.
How Do I Create Environment Variables in Windows 10?
Once logged in to Windows, right-click the corner button (the little Windows icon) in the lower-left corner of your screen, opening up the Power User Tasks Menu.
Depending on your settings, this process may open the Start menu instead. If it opens the Start menu, then type Windows-x on your keyboard instead to open the Power User Task Menu.
Click System from the Power User Task Menu that’s displayed on the screen.
Under the System menu, you need to find and click the Advanced System Settings link that you’ll find in the left-hand column under System.
If you can’t find Advanced System Settings there, then type “advanced system settings” into the search box and hit return and it will come up.
Once Advanced System Settings is open, click on the Advanced Tab then look on the bottom right side for the Environment Variables button you will find on the lower right-hand side. Click Environment Variables.
Next, to create a new environment variable, just click New.
A dialog will pop up allowing you to enter a new variable name, and to set its initial value:
- New enables you to add a new environment variable.
- Edit enables you to edit whatever environment variable you have selected.
- Delete, of course, enables you to delete the selected environment variable.
Save any changes that you make by clicking OK.
Under the Environment Variables window, choose or highlight the PATH variable in the System Variables section shown in the window.
How Do I Find Environment Variables in Windows 10?
You can either go through the procedure described above to find the environment variable information tucked away inside the system’s advanced settings.
However, if you just need to see what the variables are but don’t need to change them, you can simply open a command-line interface by hitting Ctrl-Esc and typing “cmd” in the command box, then type “set” in the command window. This prints out all the environment variables that are set on your system.
Are you interested in getting even more out of Windows 10? Learn how to create macros in Windows 10 with this handy article.
Setting Environment Variables in Windows 10
Follow the process above to get into the environment variables dialog box. After highlighting the PATH variable from “System Variables” click the Edit button. You can add or modify the path lines with the directories you want your computer to look in for executable files. You will find that each different directory is separated with a semicolon, for example:
There are other environment variables in the “System Variables” section that you can examine by clicking Edit.
Likewise, there are different environment variables, such as PATH, HOME and USER PROFILE, HOME and APP DATA, TERM, PS1, MAIL, TEMP, and so on. These Windows environment variables are very useful and can be used in scripts as well as on the command line.
Speaking of the command line, you can test your changes by opening a new PowerShell window and entering the following:
Are you interested in becoming a Windows 10 expert? Then check out Windows 10 In-Depth Guide, a comprehensive book that will turn you into a Windows 10 power user. The book covers everything from the basics of Windows 10 to long term management and maintenance.
For a how-to on using the Windows command line, check out this TechJunkie tutorial: Guide to the Windows 10 Command Prompt.
If you’re already a Windows power user, you may want to Replace Command Prompt with PowerShell in the Windows 10 Power User Menu.
Do you have any tips or tricks for setting and managing environment variables in Windows? Please tell us about it in a comment below.