Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 have no clue, but lately I've been having this problem. After running my workstation suddenly something destroys PATH and lots of stuff stops working. Initially, my path had MANY directories listed (I use Windows 7 as a development box) and after some time, I only had 3-4 directories listed in my path left.

I can't even open the System Properties dialog where I can see environment variables (because it uses shell variables to start it and it doesn't work). In short, I reboot every time.

Any ideas what might cause that problem? I didn't run anything new/unusual lately. Only VmWare (but I've been using it in the past and didn't have that problem back then).

I just checked, even %WINDIR% is not defined. WTF?!

share|improve this question
2  
I've recently had the same problem on my 64-bit Vista box. With no obvious cause, if I open a new command prompt, then the path variable is set to the part of the path defined in "User variables". The "System variables" part of the path is missing. Some, but not all system variables are undefined. The registry looks OK, and everything looks OK in the System Properties dialog (using "c:\windows\system32\systempropertiesadvanced.exe"). After reboot, the system functions normally. Problem reoccurs every few days. A full virus scan found nothing. – Lee Jan 10 '12 at 14:35
    
I had the same problem. I found a few different things that triggered it (running certain programs, running installers, etc.) but no reason those would cause it (they work fine on other machines or in a VM.) Eventually I had other problems compounding the need to reinstall which fixed everything. – Jim McKeeth Jan 17 '12 at 2:27
4  
my path was too long. I removed duplicates, removed useless entries and problem is gone. – Pavel Feb 13 '12 at 0:48
up vote 109 down vote accepted

From my blog

Bottom line, if your PATH environment variable is more than 2048 characters it (and WINDIR) stop being visible in many contexts.

I fixed it by manually running c:\windows\system32\systempropertiesadvanced.exe and deleting one entry from my PATH to put me under 2048 chars. New cmd windows work just fine.

Update: This similar question claims 2047 is the max, and elaborates on expansion rules

share|improve this answer
    
That's how I fixed the problem. I manually checked path, made it shorter and problem was gone. – Pavel Feb 13 '12 at 0:49
    
Worked for me. Thanks! – Jonathan DeCarlo Aug 15 '12 at 2:41
2  
I just fixed the problem by restarting the computer... That's really a stupid limit of Windows! – Edwin Yip Oct 22 '13 at 12:38
3  
Just ran into this problem. What a joke. Thanks – SwimBikeRun May 2 '14 at 17:37
2  
As others mentioned, after fixing your PATH, just restart explorer.exe in the task manager if you don't want to reboot. Please make sure you DO NOT launch task manager by right clicking the task bar! Doing that will initialize task manager with the jacked up path (and hence your new explorer.exe process). Launch it by doing ctrl + shift + escape – matrixugly Jun 8 '15 at 15:06

The 2048 character limitation is real. What I did is split the path in two separate variables and include the second variable in the PATH variable:

PATH=C:\;%PATHEXTENDED%
PATHEXTENDED=E:\

Like that I did not have to delete any PATH directories but got the PATH variable under 2048 characters.

share|improve this answer
1  
ok that's pretty genius – kenwarner Sep 13 '14 at 20:51
1  
Very clever, but apps that dynamically add PATH entries will likely be operating on the fully expanded path and will still go nuts. But at least the pain will be scoped to that process. – Raven Oct 27 '14 at 17:05
1  
This helped me a lot, thanks! – Zach Leighton Jul 23 '15 at 13:58
    
Thank you for this great Idea, but it unfortunatly did not work under Win7: the variable "extpath" -- or in your case "pathextended" -- was not parsed..... – Unknown6656 Dec 2 '15 at 18:43

A workaround fix for anyone trying to resolve this problem, either due to excessive path or for any other reason: just restart Explorer. The new shell picks up a new environment. This fixes the corruption for the time being, without having to reboot, even if you haven't yet been able to identify and permanently resolve the underlying cause.

1.

enter image description here

2.

enter image description here

3.

enter image description here

EDIT: update for newer versions of Windows.

Task Manager now does it in one step:

enter image description here

share|improve this answer
    
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. – Michael K Jul 11 '14 at 9:28
    
With respect, I disagree. The question is, Windows 7's PATH and environment variables are corrupted. My response provides a way to remove that corruption. This is a relevant answer both in its own right, and in conjunction with other fixes after which a reboot would otherwise be needed. – Reg Edit Jul 11 '14 at 9:36
    
I would suggest to edit Ravens answer and add your part to it. Most people will only read the accepted answer and if I understand correctly, your answer is mostly an addition to that. – Michael K Jul 11 '14 at 9:41
    
Ah, I see. No, it's relevant to any solution being tried. I've edited my answer to make that clearer. – Reg Edit Jul 11 '14 at 10:21
    
this was probably more worthwhile as a comment than an answer. That rather than restart he should end task explorer.exe and restart explorer.exe. Your answer addresses part of his problem - this part "I can't even open the System Properties dialog where I can see environment variables (because it uses shell variables to start it and it doesn't work). In short, I reboot every time." But notice that since he has a path problem after a restart, this wouldn't fix his problem anymore than he has by restarting. – barlop Jul 11 '14 at 18:32

you should get a program to monitor the registry keys

user variables

HKCU\Environment

and

machine variables

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

you might catch the moment they get destroyed and narrow it down.

also, time how long it takes..after bootup. if you can at least know when it'll happen it'll help in narrowing things down.

try safe mode too. incase it's process related, and check event viewer.

share|improve this answer

protected by Journeyman Geek Dec 11 '14 at 4:04

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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