Windows 7's PATH and environment variables are corrupted
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
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.
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.
2.
3.
EDIT: update for newer versions of Windows.
Task Manager now does it in one step: