Environment Variables, according to a better definition on Wikipedia, are a set of dynamic named values that can affect the way running processes will behave on a computer. For example, a running process can query the value of the TEMP environment variable to discover a suitable place to store temporary files, or the AppData variable to find a quick way to get access to the Roaming folder in the user’s profile folder.
In Windows, there are a few ways to discover how many of them are available and what their values are. It’s always good to discover what you can use right out of the box, isn’t it?
Through Control Panel
Search “Advanced” in Control Panel, and click View advanced system settings to Open System Properties dialog box. Advanced tab is automatically selected.
And click Environment Variables button to show what are available?
Unfortunately, this lists most of the available variables but not all. Besides, it’s quite tedious going through multiple steps to get that information. Here is a better way
Through Command Prompt window
Simply open up a Command Prompt window, and fire up a command SET, you will have a complete list of Environment Variables and their values right away.
Nice, quick, and yet, there is even a better way.
To read an Environment Variable in PowerShell, simply use the prefix “$env:“, follow by the name of the variable. What’s better is that this prefix env is actually a drive so you can use a simple cmdlet such as dir to find and list all Environment Variables at once.
PS> dir env:
Pretty cool and nicely organized.
Latest posts by Kent Chen (see all)
- The Story of How SSH Got the Port Number 22 - April 28, 2017
- Microsoft To-Do App Available in Preview on Windows 10, iOS and Android - April 19, 2017
- Windows 10 Tip: What’s Mini View in Movies & TV App and How To Use it - April 15, 2017
Last updated: 06/30/2014