Windows – Cannot resolve %windir% / Cannot modify %path% or %path% being reset on boot

environment-variableswindows 7

See Updates 3 and 4 below for how the issue has evolved


My computer (Windows 7 x64, Lenovo Thinkpad T530) is having an issue resolving %windir%. After boot-up, everything works fine. At some point a while later, the computer is suddenly unable to resolve %windir%.

Console Window

Checking the environment variables window shows that it is defined.

Environment Varibales

Checking the registry also shows that it is defined as well. I've actually deleted the key and re-entered it to no avail.

Registry

After a reboot, everything works fine for a while. Does anyone have any thoughts on anything else I can check?


Update 1:
After thinking about it some, I have uninstalled the Konica Minolta Pagebox driver/program that was installed about the time this problem started happening (see comments below). The problem seems to take about 4-24 hours (I've never timed it) to manifest, so I'll update again after that.

Update 2:
Issue is still occurring. I came back from lunch and %windir% cannot be found. I did a test after a reboot this morning and put the computer to sleep, then woke it up. %windir% was still defined after waking up.

Update 3:
Per Daniel in the comments, I ran set before and after error and compared the outputs. The first thing I noticed is that on a fresh boot my %path% is 2000+ characters long. I pruned it down to ~375 characters and verified it in a new cmd window. I rebooted, checked the path again, and it was back to over 2000+ characters (it matched what I originally saw). I truncated it again and rebooted once more and the same thing happened. I deleted the path variable and created a new one; same thing happened. At this point all I can conclude is either I cannot permanently change my path OR the path is being reset by some process on boot. Any thoughts?

Update 4:
I edited my path via the registry method suggested below. I checked my path today after running for a while and it has grown from what I entered into the registry; it now has a few new entries and a lot of duplicates. The only new entries are from SQL Server 2012. I went to change this in the registry and I noticed that the registry does NOT match the output of echo %path%. Checking the Environment Variables from the Advanced Properties Tab shows a third version of my path.

Registry Path:
C:\Program Files (x86)\Microchip\mplabc30\v3.30\bin;
C:\RUBY193\BIN;
C:\Windows\SYSTEM32;
C:\Windows;
C:\Windows\SYSTEM32\WBEM;
C:\PROGRAM FILES\COMMON FILES\LENOVO;
C:\SWTOOLS\READYAPPS;
C:\PROGRAM FILES (X86)\COMMON FILES\LENOVO;
C:\PROGRAM FILES (X86)\MICROCHIP\MPLAB C32 SUITE\BIN;
C:\HTSOFT\PIC18\BIN;
C:\PROGRAM FILES\TORTOISESVN\BIN;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;
C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;
C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;
C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;

Command Line path:
C:\Program Files (x86)\Microchip\mplabc30\v3.30\bin;
C:\RUBY193\BIN;
C:\Windows\SYSTEM32;
C:\Windows;
C:\Windows\SYSTEM32\WBEM;
C:\PROGRAM FILES\COMMON FILES\LENOVO;
C:\SWTOOLS\READYAPPS;
C:\PROGRAM FILES (X86)\COMMON FILES\LENOVO;
C:\PROGRAM FILES (X86)\MICROCHIP\MPLAB C32 SUITE\BIN;
C:\HTSOFT\PIC18\BIN;
C:\PROGRAM FILES\TORTOISESVN\BIN;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;
C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;
C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;
C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;
C:\Program Files(x86)\Microchip\mplabc30\v3.30\bin;
C:\RUBY193\BIN;
C:\Windows\SYSTEM32;
C:\Windows;
C:\Windows\SYSTEM32\WBEM;
C:\PROGRAM FILES\COMMON FILES\LENOVO;
C:\SWTOOLS\READYAPPS;
C:\PROGRAM FILES (X86)\COMMON FILES\LENOVO;
C:\PROGRAM FILES (X86)\MICROCHIP\MPLAB C32 SUITE\BIN;
C:\HTSOFT\PIC18\BIN;
C:\PROGRAM FILES\TORTOISESVN\BIN;
C:\Windows\System32\WindowsPowerShell\v1.0\;

Environment Variables path:
C:\Program Files (x86)\Microchip\mplabc30\v3.30\bin;
C:\RUBY193\BIN;
C:\Windows\SYSTEM32;
C:\Windows;
C:\Windows\SYSTEM32\WBEM;
C:\PROGRAM FILES\COMMON FILES\LENOVO;
C:\SWTOOLS\READYAPPS;
C:\PROGRAM FILES (X86)\COMMON FILES\LENOVO;
C:\PROGRAM FILES (X86)\MICROCHIP\MPLAB C32 SUITE\BIN;
C:\HTSOFT\PIC18\BIN;
C:\PROGRAM FILES\TORTOISESVN\BIN;
C:\Windows\System32\WindowsPowerShell\v1.0\;

It looks as though the command line path = registry path + environment variables path. I attempted to set the registry path and the environment variables path to the same thing and reboot. After reboot, my path is now doubled, basically two back-to-back copies of the registry path above.

Once again, any thoughts?

Update 5: After talking with the IT Manager, he says he is fighting a similar issue on another computer. Both computers have SSDs (seems to be the only common factor). This may or may not be pertinent.

Best Answer

I had the same issue and found this question first. However, the real cause/solution is not mentioned yet in this question, but it is mentioned here: Windows 7's PATH and environment variables are corrupted

Summary of the solution: make sure your path is < 2048 characters. Check in both the user variables and the system variables.