Environmental Variables Disappearing In Windows
I started noticing it a couple of days ago: icons on my task bar, such as the File Explorer, stopped working and gave me that annoying “application cannot be found” message. Other programs just stopped working.
I hunted around and found that my PATH variable in a console window was only listing the additional path items from the “User” environment. The “System” (aka “Machine”) PATH environmental variable was not being appended to the front of the “User” PATH.
I tried to open “Computer > Properties > Advanced Properties” and it said it couldn’t find the Advanced Properties dialog and it gave the path to the app using “%windir%”. So I opened up a console and typed “SET” and the majority of the System environmental variables were missing.
What was going on?
I hunted and hunted and finally found this: Windows 7’s PATH and environment variables are corrupted.
Can you believe that? When your path goes over 2048 characters long the entire environmental variables handling in Windows goes haywire.
I edited my PATH and took out a bunch of duplicate entries (what added those?), got it down to a much smaller size and suddenly my Win7 machine was working perfectly again.
It seems like a serious omission that Windows gives no warning at all that there is a problem and we poor buggers have to figure out what to do.
I hope this post helps someone out there with the same headache.