Understanding and accessing environment variables is fundamental to effectively manage and configure system settings on Windows. Environment variables store essential information, such as system paths, user preferences, and system configurations, which applications and scripts often rely upon. Displaying all these variables can provide valuable insights into the system's state and can be crucial for troubleshooting or customizing the computing environment. This tutorial provides 2 methods how to print all environment variables on Windows.
Method 1 - CMD
Command Prompt (CMD) provides the SET
command to manage environment variables. This command enables to view a comprehensive list of environment variables and their corresponding values.
SET
Output example:
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\User\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
...
Method 2 - PowerShell
PowerShell, a more advanced and versatile command-line interface, offers the gci env:
command to access environment variables. This command will present a detailed list of all environment variables, including their names and values.
gci env:
Leave a Comment
Cancel reply