Displaying Environment Variables in Windows: A Step-by-Step Guide
Introduction
Environment variables are a crucial part of any operating system, allowing you to customize and personalize your system settings. In this article, we will explore how to display environment variables in Windows, including how to set them, view them, and modify them.
Setting Environment Variables
To set environment variables in Windows, you can follow these steps:
-
Open the System Properties Window
- Press the Windows key + Pause/Break to open the System Properties window.
- Alternatively, you can right-click on the Computer or This PC icon and select Properties.
-
Click on Advanced System Settings
- In the System Properties window, click on Advanced system settings.
- This will open the System Properties window with the Advanced tab.
-
Click on Environment Variables
- In the System Properties window, click on Environment Variables.
- This will open the Environment Variables window.
-
Click on New
- Click on the New button to create a new environment variable.
- Enter the variable name and value in the Variable name and Variable value fields, respectively.
-
Click on OK
- Click on OK to save the new environment variable.
Viewing Environment Variables
To view environment variables in Windows, you can follow these steps:
-
Open the Command Prompt
- Press the Windows key + R to open the Run dialog box.
- Type
cmdand press Enter to open the Command Prompt.
-
Type
echo %windir%- Type
echo %windir%and press Enter to display the current directory.
- Type
-
Type
echo %PATH%- Type
echo %PATH%and press Enter to display the current system path.
- Type
-
Type
echo %USERPROFILE%- Type
echo %USERPROFILE%and press Enter to display the current user profile.
- Type
Modifying Environment Variables
To modify environment variables in Windows, you can follow these steps:
-
Open the System Properties Window
- Press the Windows key + Pause/Break to open the System Properties window.
- Alternatively, you can right-click on the Computer or This PC icon and select Properties.
-
Click on Advanced System Settings
- In the System Properties window, click on Advanced.
-
Click on Environment Variables
- In the System Properties window, click on Environment Variables.
-
Click on Edit
- Click on Edit to modify the environment variables.
-
Add a new environment variable
- Click on New to create a new environment variable.
- Enter the variable name and value in the Variable name and Variable value fields, respectively.
-
Click on OK
- Click on OK to save the new environment variable.
Common Environment Variables
Here are some common environment variables in Windows:
| Variable Name | Variable Value |
|---|---|
%windir% |
The directory where Windows is installed |
%PATH% |
The system path where programs are located |
%USERPROFILE% |
The user’s profile directory |
%HOMEDRIVE% |
The drive letter of the user’s home directory |
%HOMEPATH% |
The path to the user’s home directory |
Tips and Tricks
- To display environment variables in a specific directory, use the
echo %windir%command with thedircommand. - To modify environment variables, use the
echocommand with thesetcommand. - To view environment variables, use the
echocommand with the%windir%variable. - To delete environment variables, use the
delcommand with the%windir%variable.
Conclusion
Displaying environment variables in Windows is a crucial part of customizing and personalizing your system settings. By following these steps and tips, you can easily set, view, and modify environment variables in Windows. Remember to use the echo command with the %windir% variable to display environment variables in a specific directory.
