In programming, variables are the location that holds a value, and value can be anything. It can be a filename, or number, or any other data. In the same way, there are Environment Variables in your Operating System. Environment Variables are global variables that hold values related to the current working environment and can be used by the operating system and other applications to get necessary OS information
or Environment Information. Environment Variables are available in Windows, Mac, and Linux.
They are formed as number/value pairs and those values can be access by the OS and application as needed.General Format of environment value looks like this:
Variable1 = C:\xyz
Variable2 = 6
variable4 = val1;val2
These types of environment variables can be viewed, created, edited, and deleted. Environment Variable in general helps applications to know which directory to install installable files, where to find user and system settings.
Some of the environment variables are PATH, USER, HOME, UID, SHELL, TERM, EDITOR, etc.PATHTEXT, OS, TEMP,SYstemRoot.PATH is a popular Environment variable that is available in Windows, Mac, and Linux.
If you want to know what environment variables are used in various OS then I will guide you for this.
List of Environment variable in Windows Environment
There is various way to listing environment variables in windows. Let's discuss some of them.
1) List environment variables using Command Line
In command prompt type :
and press Enter.
Some of the most common environment variables:
AppData: AppData contains data and settings of various installed programs on your PC.
COMPUTERNAME: Unique identifier is given to your computer
HOMEPATH: HomePath describes the path for user personal files. It contains user files like download, Desktop, Documents, Videos, Picture, Contacts, and many more.
PATH: The PATH variable provides the directories on the machine where executable programs can be found.
If you want to save this variable for a future look then you can save it in a text file with the following command.
Here, I have used output.txt as file name and this file get saved under C:\User\Dell path and contain output.txt look like this:
2) List environment variables using Powershell
You can simply type below one line to get all environment variables.