9

When I fresh boot my computer everything is dandy. Then after a few hours applications like Visual Studio, Notepad++, Games, iTunes, Windows components (Cmd prompt, Explorer, etc.), etc. stop working with errors about missing files or not being installed correctly.

I found that if I browse out to Cmd.exe and run it directly (instead of from the menu link) then I can run it, and the WinDir environment variable and others are missing (which explains why I can't run Cmd.exe from the shortcut since it uses %WinDir%\System32 for the path) and the system path is set to (NULL).

When I go to Advanced System Settings (again manually exploring to SystemPropertiesAdvanced.exe) all the environment variables are still there. I checked my memory utilization and I have 1 of 6 Gig free, with my Commit Charge peak well bellow the limit (like 30%).

The clipboard also stops working too.

Not running anything to exotic, although I do have a lot of Chrome tabs open. Running Backblaze for backup, Microsoft Security Essentials, and various other utilities. Closing things one at a time hasn't seemed to fix it.

It has been getting progressively worse (happening sooner and sooner). Would like to know what is causing it without reinstalling.

Running Windows 7 Ultimate 64-Bit

5
  • This happens every time you boot and work for a while?
    – Synetech
    Jan 24, 2011 at 20:33
  • 1
    @Synetech: Lately it has been happening every time, but not after the same interval. Haven't discovered the pattern yet, expect that it frustrates me until I reboot. Jan 24, 2011 at 21:50
  • Could it be a handle leakage? Have you checked task manager and enabled the relevant columns in the process tab to see if any of the processes are gobbling up all your handles? Jan 24, 2011 at 22:43
  • I have the same issue where most of my environment variables go missing. It seems to only occur after my system wakes from sleep. I'm running Windows 7 Enterprise 32-bit on a domain.
    – user65691
    Feb 2, 2011 at 6:03
  • I started seeing the same symptoms on 64 bit Vista in December. My PC can run for a few days before this happens and I need to reboot. Kaspersky anti-virus has found no problem. Also reported here: [superuser.com/questions/355594/…
    – Lee
    Jan 11, 2012 at 9:28

4 Answers 4

8

Been fighting with the same problem. Symptoms:

  • reboot: all OK
  • after a while: programs seem to lose %windir% environment variable and therefore things start to break

In my case, I had a somewhat big %PATH%, so I trimmed down a lot of entries from PATH and it got fixed. Not sure how a big PATH can clean WINDIR but it seemed to have fixed it.

The effect of the fix isn't immediate (you have to reboot or restart explorer), but I can verify it by using task manager to kill explorer.exe and open it again (thus avoiding a reboot). Task Manager inherits environment variables from winlogon whereas process explorer seems to inherit them from whatever process started it, so it may keep your big environments problem even though you changed them.

1
  • 1
    This did the trick for me. I recently installed a program that but a whole bunch of stuff on my path, once I removed those entries, everything started working again.
    – Eric Milas
    Dec 20, 2012 at 18:07
2

I also had a very long %PATH% environment variable. As a software engineer, I typically have several applications installed and removed from my computer on a regular basis. It is common for some applications to insert a semi-colon delimited entry into the %PATH% environment variable, typically if there is a potential that the installed application will execute from the command line (cmd.exe) because I am not too concerned with which applications will execute from the standard command line, I backed out all entries from the %PATH% variable except for C:\Windows\System32 (the place where most of your "cmdlets" are going to run from. A bit more information can be found on the topic on wiki-pedia @ http://en.wikipedia.org/wiki/PATH_(variable) For a quick fix (Windows 7) do the following:

1.) Click Start, in the search box at the bottom of the menu, copy and paste or type the following to open the System Advanced Properties Window C:\Windows\System32\SystemPropertiesAdvanced.exe (press enter)

2.) Click the Environment Variables button near the bottom of the window just slightly above the ok, cancel and apply cluster.

3.) The Environment variables window should be displayed now. In the second list box on the screen with the header text (System Variables) look for the word Path under the column Variable and Double Click it.

4.) You should be looking at what appears to be a list of directories on your computer that are separated by the ; delimiter. Take close attention, some you may want and some you may wonder why they are present, clear as many of the paths as your heart desires, the idea here is to shorten the path as much as you feel comfortable doing, again I shortened mine to C:\WINDOWS\system32 and have had no issues since.

5.) Once you have completed editing the Path variable, click "Ok" on all of the open dialog windows.

6.) Once again, click on start, in the bottom search bar, type taskmgr and press enter on your keyboard.

7.) Click on the "Processes" Tab and locate the process "Explorer.exe" under the "Image Name" column of the process grid. Click the process once to highlight it, then click the "End Process" button.

8.) Click File (if you do not see it, press the alt key first), click the sub menu item under file "New Task (Run)"

9.) In the input box displayed type explorer and press enter or click ok.

Test your broken links / shortcuts to see if they now work.

1

Per Lasse V. Karlsen's suggestion I looked for a really high Handle count next time it happened. Audacity had 41K of them, and it has been rather unstable lately too. Unfortunately I have the latest version (1.3.12), and closing it doesn't seem to reclaim all of the handles. I'll file a bug report.

NOTE: While Audacity was leaking handles, this does not appear to have been the only cause of my headache. Still having troubles and haven't used Audacity since reboot. May be time for a reinstall.

I ended up reinstalling before finding a fix.

0

I got similar symptoms but my PATH variable was not too long. So I thing it's good to share my experience here :

I was installing a Visual Studio extension when VSIXInstaller.exe has crashed. After that, some environment variables disappeared (including %windir%). It was impossible to launch Visual Studio.

Don't know why this crash has affected environment variables but I'm sure it's linked because I repeated this scenario multiple times.

I found out why VSIXInstaller.exe was crashing and everything goes well now.

2
  • This is potentially useful only if you explain what you found out and how you fixed it. Otherwise, this isn't an answer, it's an "I'm having this problem, too" comment.
    – fixer1234
    Jan 7, 2015 at 18:25
  • Hello @fixer1234, you're right. So here's why VSIXInstaller crashed in my scenario : I made a batch script to launch VSIXInstaller on 2 vsix files, then delete these 2 files. The problem is that VSIXInstaller is asynchronous and is not a good solution to script vsix's installation. My script was launching 2 installations in parallel and was deleting the files before the end of it. As a workaround, I made a subroutine which wait for VSIXInstaller.exe end. I also found an alternative to VSIXInstaller but didn't tried it : link
    – GGES
    Jan 9, 2015 at 9:05

Not the answer you're looking for? Browse other questions tagged .