How to recover deleted environment variables?
Note: This will only work if your command prompt was in open state.
I accidentally added a new PATH instead of editing it, and I lost my other path variables.
Tried following steps to recover my variables successfully on my Windows 7.
- Open CMD (Win + R and type
cmd
without quotes) - Type
echo %PATH%
- copy the path variables
- Go to "My Computer" properties -> "Advanced system settings" -> click on "Advanced" tab -> click on "Environment Variables" button -> Edit "PATH" variable and paste everything copied in the third step in -> Variable value: box.
- Click OK in all the opened windows.
- In Windows 10 navigate to Start > Settings > Update & Security > Recovery
- Under Advanced Startup, click Restart Now
- Once the computer reboots into Advanced Startup, click Troubleshoot
- Click Refresh Your PC
Windows 10 restores, keeps all files and apps but removes drivers and custom settings.
I face same issue like it, and I used "System Restore" for undo changes on path.
- Open Start.
- Search for Create a restore point, and click the result System Properties.
- Click the System Restore button.
- Click Next.
- Select the most recent known working restore point that will help you to fix the current problem.
- Click the Scan for affected programs button to see the applications that will be removed if they're installed after the restore point was created.
- Click Close.
- Click Next.
I was also facing the same issue and after searching everywhere i found the default path
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\
just copy this path and paste it to your path environment variable.