Wednesday, June 3, 2015

Windows 7 - %windir% is not recognized as an internal or external command

June 03, 2015 Posted by Jason Irwin

I’m in the process of getting acquainted with my new work laptop, a Lenovo W550s. I’ve had the laptop for a couple of weeks now, and very recently, and randomly, strange things started to happen.

I started getting weird error messages when I attempted to perform any kind of system related tasks and couldn’t modify the domain I was connected to.


Icons in the start menu (Command Prompt, Paint, Snipping Tool, etc.) changed from meaningful to generic, indicating that something was wrong.



I came very close to reimaing by brand new laptop, until the realization that %windir% was not accessible led me to the hunch that my path was corrupted. It wasn’t corrupted, it was just too long. While my user path was short and sweet, the system path environment variable was full of garbage, weighing in at 2164 characters, full of references to varying pre-installed lenovo and intel software. After some more digging it appears that Windows can handle up to 2048 characters but no more. After saving out the old path I removed a bunch of (what I perceive to be) junk, rebooted, and things are back to normal. Phew!