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.

  1. Open CMD (Win + R and type cmd without quotes)
  2. Type echo %PATH%
  3. copy the path variables
  4. 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.
  5. Click OK in all the opened windows.

  1. In Windows 10 navigate to Start > Settings > Update & Security > Recovery
  2. Under Advanced Startup, click Restart Now
  3. Once the computer reboots into Advanced Startup, click Troubleshoot
  4. 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.

  1. Open Start.
  2. Search for Create a restore point, and click the result System Properties.
  3. Click the System Restore button.

enter image description here

  1. Click Next.

enter image description here

  1. Select the most recent known working restore point that will help you to fix the current problem.
  2. 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.
  3. Click Close.
  4. Click Next.

enter image description here


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.