So recently I started getting many incidents of the error “The system cannot find the path specified” when running just about anything from the windows command line and sometimes from the Git Bash shell. It was really weird because everything seemed to be working just fine: tests would pass, rails would function normally, etc, but I would get “The system cannot find the path specified” between various lines of output with seemingly no rhyme or reason.
I let this error go for a while since it wasn’t really breaking anything, but eventually it started to piss me off because it wasn’t even letting me know WHAT path it couldn’t find!
And to make matters worse, around the same time that the error started happening I had:
- Installed JRuby on this computer for the first time
- Moved the physical location of the computer and was plugged into a different ethernet port
- Mucked about with my PATH and some other environment variables
- Tried to organize some files in a saner way
I really had no idea which one of these things was likely responsible. Searching for this problem was tough since the error message was so general and can be caused by any number of things, and I didn’t find anything that corresponded to the things I had done above, exactly.
So eventually I asked Jake what to do about this, and he recommended using Process Monitor to try and see what path was not being found. I fired it up, set up a filter to only show events from cmd.exe, ran a fast-running command that I knew would have the error, and started reading the logs.
The key entry had a Result of “PATH NOT FOUND”:
| Process Name | Operation | Path | Result | Detail |
|---|---|---|---|---|
| cmd.exe | CreateFile | C:\Documents and Settings\nichols\Desktop\ansi132\x86\ | PATH NOT FOUND | Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, AllocationSize: n/a |
And there we have the culprit: me, surprise surprise ;) When the standard way of getting terminal colors on windows switched from the windows32 gem to ANSICON (in RubyInstaller, Cucumber and RSpec), the first time I had installed ANSICON (by running it with -i) was from that location on my desktop. Then I moved it when doing the cleanup mentioned above, and I didn’t run -u before I moved it, so the registry entry that -i adds didn’t get removed.
The particular registry entry causing the trouble was a few lines up in the Process Monitor logs; it was “HKCU\Software\Microsoft\Command Processor\AutoRun”. It actually had both the old location and the new location of ANSICON at this point, so I backed up my registry to be safe, removed the path to my Desktop from that value, and the errors were no more! Whew.

Thanks Carol, this just saved me a ton of time.
Awesome, Shane! I’m glad this helped you :D
Wow, exactly what I’ve been looking for. Thanks, man.
You saved me a lot of time, too.
You’re welcome! Glad to hear it!! :D
Omg!
You can’t even imagine how much you just helped me! :o
I was so desperate I was about to completely reinstall my windows :D
You are very welcome!!!!
I had a simple issue and found this useful.
http://windowsxp.mvps.org/autoruncmd.htm
Goodness… thank-you so so so so so so so soooooo much. I had already uninstalled ruby/devkit/git etc etc but with no result. Thank goodness i found your post before throwing my toys out of the cot and deciding to do a complete windows re-install. Thank-you ever so much for taking the time to post this.
You are so welcome!!!
Thanks Carol. This is exactly the problem I was running into. I cleared the registry (it had two old paths to ansicon from prior installations). Then, to be certain I had the right path, I reinstalled ansicon: Unzipped to c:\ansicon140 and ran the .exe -i from that folder. The registry updated to the new location, and I no longer get those annoying ‘cannot find the path specified’ errors.
Have read “History repeats itself”, Oh! Boy, did I see it for myself.
Thank you Carol for the wonderful blog.
Thank you so much, I was pulling my hair out. For those who are uncomfortable mucking around in the registry, I was able to copy the ansicon folder back to the location I had installed it in. cd there from the command line, run : ansicon -u , then cd to the new location and run: ansicon -i . This fixed the problem without me having to directly interface with the registry.
Thanks, this was making my maven tests fail.. heh
Thanks for this post! This saved me!
This helped me a lot. I had the same problem with ANSICON, but it was preventing me from successfully building native extensions! THANK YOU!!
Pingback: ¿Cómo que: “The system cannot find the path specified”? - David Martos @ SharePoint en Geeks.ms
Thanks Carol, I was thinking to re-install my operating system and your solution helped me in saving the full route of installation. Once again thank you a lot.
Yet another note of appreciation :) Thanks a bunch–it would have taken me forever to figure it out.
Hi Carol,
Thanks a lot…. :-) :-)
It was really a great help, This issue had frustrated me for last 3 weeks.
Can you please help me on how to install ANSICON properly.
Regards
Vipin
Awesome, this pretty much saves the day for me :-)
Oh god thanks so much Carol! I was trying to re-install Git and was getting this error and had no idea why. I actually stumbled here by accident when clicking from another GH issue that didn’t really have anything to do with my initial problem.
Thanks so much, that darn registry value was the culprit.
Helped me too, thanks!
I was able to find it witht he app th eyou gave a link to, but im confused as to what I am supposed to do with it once i’ve found it
Thanks