Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I accidentally deleted the Path environment variable by creating a new one with Path name. How can i restore my old Path environment variable?

share|improve this question

I lost my PATH with a program install earlier today, but with all the existing programs already running, it was easy to get it back. If you have a command window open, run:

echo %PATH%

If you don't, you can look at the environment variables of currently-running programs with Process Explorer (procexp).

share|improve this answer
HOLY CRAP. I dont know why this didn't occur to me but you just saved me a humungous headache. TY. – dudewad Mar 20 '15 at 20:18
The "Ahah!" moment for me back when I posted this was quite rewarding. – Thomas G. Mayfield Mar 20 '15 at 22:07
Oh, you from the past. Thank you so much for unscrewing my total screw up. I was lost but because of you I saw the light and found the path again. – Sage Pourpre Nov 28 '15 at 4:17
All hail Thomas, savior of us all. – ARM Jul 8 at 22:17

I followed the advice in the answer to a related question here and recovered my previous path setting as of this morning using regedit. Expanding a bit on that answer, here's how I did it. (Read the linked answer to get the full instructions, I don't provide all the details here.)

I selected my earliest backup from today (11:43 AM timestamp in 'Today' section)

Example of previous versions of RegBack

and examined the earliest ControlSet within the HKEY_LOCAL_MACHINE/System node of that copy of the registry file, ControlSet002:

enter image description here

and copied out the previous value of my path variable from the key Control\Session Manager\Environment\Path within that level.

enter image description here

Your mileage may vary, as I don't know exactly what triggers the backup of the registry.

share|improve this answer
Even easier, a note from the old question "Note that for System, depending on how long ago this was, you can just go back into HKLM(old control set version)\Control\Session Manager\Environment without loading an old hive" – Jahmic Mar 12 '14 at 6:38

You could do a system restore.

To restore your PC using System Restore

Swipe in from the right edge of the screen, and then tap Search. (If you're using a mouse, point to the upper-right corner of the screen, move the mouse pointer down, and then click Search.) Enter Recovery in the search box, tap or click Settings, and then tap or click Recovery.

Tap or click Open System Restore, and follow the prompts.

share|improve this answer

I have just retrieved it by doing as follows: My previous Path settings was still on the dos cmd prompt screen. So right click on it with your mouse. Take 'Select All'. This copies your screen. Open Notepad, and paste. Now highlight the Path definition in notepad, right click and copy. Go back to dos cmd prompt screen. right click and paste This has worked for me so Good Luck!

share|improve this answer
This duplicates information already present in another answer, and pre-supposes that one happens to have a command prompt already open in this situation. – bertieb Sep 5 '15 at 15:38

Another way to restore the default PATH, for both current user and machine user, is to use an useful application that I developed in .Net platform, with name PATHS.

Usage would be:

PATHS.exe /Restore

It is a freeware tool to add, delete, clean or restore the PATH and PATHEXT, it can be downloaded here, including source-code:

enter image description here

enter image description here

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .