Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

5 Answers 5

up vote 51 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
    
Just happened to me a couple days ago and I couldn't figure out why anything with %windir% just went bonkers. Fixed, thank you! –  Jesse Slicer Jul 15 '13 at 15:25
    
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
1  
Just ran into this problem. What a joke. Thanks –  SwimBikeRun May 2 at 17:37

I tried to comment on @Raven but I don't have enough Reputation to do so. So I am creating a separate answer.

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
    
ok that's pretty genius –  qntmfred Sep 13 at 20:51
    
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 at 17:05

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

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 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 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 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 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 at 18:32

This may be a virus, or perhaps somebody just accidentally deleted it.

Check for viruses using the many options available.

There maybe system restores/backups available, but I'm not sure if system restore environment variables.

You need to format the HDD if the virus check fails.

share|improve this answer
1  
Unlikely, i'm a professional programmer and I don't run crap on my pc. There is no problem with it (other than that win7 is trash), it's only after some time environemnt get's busted and simple reboot fixes it. –  Pavel Nov 9 '11 at 19:06
    
What are the "many options possible?" Could you expand on that? –  Simon Sheehan Nov 9 '11 at 20:14
2  
@Pavel Watch-out getting cocky about being a "professional programmer" and imune to viruses. Sure, being a responsible user who knows their way around the computer reduces the likelihood, but anyone can get a virus. –  Jim McKeeth Jan 17 '12 at 2:25
1  
I do some low-level system stuff, that's my job to know what's going on with the box. That's what I meant. So, I know quite well what can make my pc go banana. In short it seems there is a bug or some strange behavior if you have too make path entries. I manually edited it, removed duplicates and problem is gone. –  Pavel Feb 13 '12 at 0:47

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

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.