"I feel like an idiot" is of course obligatory and accurate as an introduction. Anyway, instead of adding to the user path, I accidentally overwrote it, and lost everything in it. I haven't restarted the system yet. How can I find that information and put it back where it belongs before it's lost forever?
2 Answers
Open Regedit.exe and check HKEY_CURRENT_USER\Environment\Path if that doesn't have the old value anymore, you can try to look at a backup of your user profile.
You need the file C:\Users\username\NTUSER.DAT from a backup,
In Registry editor, select HKEY_Users, in the File menu choose Load Hive... and pick the file mentioned above, give it a name. Look in Environment\Path. When done you should unload the hive using File menu Unload Hive... while the loaded hive is selected.
If you have any programs open which you started before you changed the variable you may want to check the environment variables for those processes in Process Explorer. Explorer.exe would be an option.
- 14,315
I know this is an old question. But I did the same thing. The security policy on my workstation restricts regedit so I did the following.
- Open PowerShell.
%env = Get-ItemProperty -Path "HKCU:\Environment"%env.path- If this returns the previous value then save a copy of it in notepad (just in case) and replace your local path variable with that.
- if you want to stick to powershell, you should be able to use
Set-ItemProperty -Path "HKCU:\Environment" -Name Path -Value %env.path
- 121