How to recover path environment variables on Windows 10
Users can edit the path environment variables on Windows 10. It’s really easy to do though you need admin rights to make the changes. The path environment variables aren’t all populated by users. There are a few default paths that are part of it. Users can always add or remove them. If you’ve accidentally deleted a single path environment variable, or all of them, you can add them back. If you don’t remember every single path that was added, you can try a few things to restore path environment variables on Windows 10.
Limitations
There are limitations to the methods we’re going to list for recovering the path environment variables. The first is that you should not have restarted your system after removing/deleting them. If you have Command Prompt or PowerShell open, your chances of recovering the path environment variables is much better.
Windows Registry
Tap the Win+R keyboard shortcut to open the run box. In the run box, enter ‘regedit’. Tap Enter. Once the registry editor is open, navigate to the following location;
HKEY_CURRENT_USER\Environment
The values under this key will list the path environment variables. Double-click to open them and copy the path from them all to Notepad. Go ahead and add them back.
It is possible that the Environment key is empty. This is most likely to happen if you restarted your system. In such an event, search the registry for a key named ‘Environment’ and check the values under whatever comes up in the results.
PowerShell
If you already have PowerShell open from before the variables were deleted, switch to it and run the following command. It will be able to read the old path environment variables. You can try running it in a new PowerShell window but it may not work.
Get-ItemProperty -Path "HKCU:\Environment"
Command Prompt
Like the PowerShell method, this too only works if you have a Command Prompt window open from before you deleted or modified the variables. Run the following command and it will return the path environment variables.
echo %PATH%
NTUSER.DAT backup
If you have a back up of your user profile, look for a file called NTUSER.DAT in it. This file’s contents will have your old path environment variables in it. Of course, this method relies on the back up existing in the first place.
The above methods work but they require certain conditions to be met. It goes without saying that it isn’t easy to recover path environment variables once they’re lost and in many cases, you might be better off restoring your system.
I usually don’t comment anywhere, but I need to. You just saved my ass. I can’t thank you enough. I just deleted my path variable accidentally, and you helped me restore it.. It would’ve been a pain in the ass to find all the variables. Thank you.
Kinda useless if you dont have any original items for reference /to add, into the paths!
E.g… you delete your paths or you add wrong variables into them…. how to recover to default lists of Path’s?