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.
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.
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;
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.
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"
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.
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.