6

I use a Windows 7 x64. I just accidentally deleted my user path environment variable and was trying to recover it. I'm glad I found what I really need here.

But I don't understand what exactly "Navigate to your user folder" (in point #4) means. What is my user folder?

7

Your user folder is the folder that contains your "personal" folders and files, like "Desktop" and "MyDocuments". You can find your user folder by opening a Command Prompt window and typing:

C:\>echo "%userprofile%"
"C:\Users\yourusername"

C:\>


Whatever is displayed for you is your user folder: "C:\Users\yourusername"




Here is an easy way to recover the previous Path, without having to deal with permanently rolling back to a previous System Restore Point, and without having to use the Registry Editor (Regedit).

  1. Insure that you have saved a current System Restore Point.
  2. (Temporarily) roll back to a previous System Restore Point that was saved before the Path variable was deleted.
  3. Open a Command Prompt window.
  4. Insure that the Path variable has your desired value:

    C:\>echo %Path%
    C:\Windows\System32\;C:\Windows\;C:\Windows\System32\Wbem

    C:\>

  5. Save a copy of the Path variable:

    echo @set "Path=%Path%">"%userprofile%\Desktop\setpath.cmd"

  6. Restore the System Restore Point from Step 1.

  7. Using Notepad or your favorite text editor, open the file:

    "%userprofile%\Desktop\setpath.cmd"

  8. Select the Path value and copy it to the Clipboard.

  9. Open the Environment Editor:

    Start (orb) --> right-click Computer --> Properties --> Advanced system settings --> Advanced-tab --> Environment Variables

  10. Locate the Path variable in either the User variables or System variables section, according to your needs and click Edit.... Or, if no Path variable is found, click New... and type Path into the Variable name textbox.

  11. Paste the Path value that you copied to the Clipboard in Step 8, to the Variable value textbox.
  12. Click OK to save the restored Path value.
  13. Click OK to close the Environment Variables editor window.
  14. Click OK to close the System Properties window.
  15. Close the MyComputer-Properties window.

You are done. You have retained your current System Restore Point and restored the deleted Path variable.

Save a new System Restore Point which will contain the restored Path variable.

You can retain the file:

"%userprofile%\Desktop\setpath.cmd"

in case you need to restore the Path variable again in the future.

5

Found a simple solution at https://www.youtube.com/watch?v=C1W04pawwqU

  1. Open regedit and find key Path under HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\Session Manager\Environment
  2. Copy data for Path key
  3. Goto Control Panel > System > Advance System Settings > Advance Tab > Environment Variables
  4. Edit the Path variable under System Variables and append value copied in step 2 above
  5. Click Ok to save.
  • my problem is a system path variable, however when i go to HKEY_LOCAL_MACHINE i do not see ControlSet002 under SYSTEM. Any help? – Ungeheuer Oct 18 '16 at 12:19
  • It works only till you have not refreshed the environment or not restarted pc. – Da Man Dec 23 '18 at 15:07
1

Hi I followed Ajay's answered and noticed that it's for System Variables. Then I found the solution for User Variables.

Open regedit and go to the path HKEY_USERS.Default\Environment instead, then copy the path you found and paste to Control Panel > System > Advance System Settings > Advance Tab > Environment Variables

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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