There are 2 places to add or edit windows environmental variable
- User variables [i.e Current user]
- System variables [i.e common to all users]
Problem
There are situations when you want to restore environmental variables, situations may be accidentally you have deleted variables or system crashed or you changed your computer…
We will see different ways we can backup environmental variables for future references
Solution
Method1
Open command prompt, type “SET” and enter
C:\Users\userName>set
this will list all the environmental settings on your machine.
You can even push the result displayed in to a text file
C:\Users\u0146751>set >> c:\envSetttings.txt
This command will help you to write all your environmental settings to a text file envSettings.txt under C:\ drive. [You can provide your own file name and path]
Method2
Backup the environment registry
Open registry – Start | Run | regedit
Navigate to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
Click on the Environment folder, and this will list all the system variables set for your machine
to backup, click on File | Export
and save as .reg or .txt format
-
HKEY_CURRENT_USER\Environment
This will list all the environment variables set for the current user
to backup, click on File | Export
and save as .reg or .txt format