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
    
Remember that each Windows console session has its own PATH environment variable, which can be displayed or changed using the PATH command. But if you close the console and open a new one, the original system PATH will be restored. I'm not sure if this is the case with an elevated console session. – Baodad Aug 9 at 18:29

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
1  
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
1  
The "Ahah!" moment for me back when I posted this was quite rewarding. – Thomas G. Mayfield Mar 20 '15 at 22:07
2  
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
1  
Excellent answer. Saved me from restoring a backup. May I share a potentially not-so-obvious trick of how to open a command window if you don't have one open. If you have a program that has an open dialog (I used Chrome since it was open before I lost the path), hit Ctrl-O to open a website. Navigate to C:\Windows\system32\ and find cmd.exe. Right-click on cmd.exe and click Open. This will bring up a command prompt with the environment variables of the software (chrome in this instance) and you can echo %path% to get your old env variables! – triadiktyo Oct 3 at 14:28

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
1  
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
    
What is MOLD? When i go to the previous versions of Regback, I see one previous folder, and despite the depth of the linked answer, I still don't know what to do. Also, how did you manage to open the HKEY_LOCAL_MACHINE/System node of any Regback folder? – Adrian Oct 18 at 2:50

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

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:

http://www.mediafire.com/download/ffuxgwezf4jd5c0/PATHS.rar

enter image description here

enter image description here

share|improve this answer
    
Do you have a website with a more reliable download/updates? Can you confirm this is the latest version? Are there known bugs? – beppe9000 Jul 31 at 17:54
    
The title makes me want to play old nineties games. – xdhmoore yesterday

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.