The system cannot find the path specified

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.

This entry was posted in Ruby on Windows and tagged , , , . Bookmark the permalink.

23 Responses to The system cannot find the path specified

  1. Shane Emmons says:

    Thanks Carol, this just saved me a ton of time.

  2. Juraj Masar says:

    Wow, exactly what I’ve been looking for. Thanks, man.

    You saved me a lot of time, too.

  3. Inori says:

    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

  4. td says:

    I had a simple issue and found this useful.
    http://windowsxp.mvps.org/autoruncmd.htm

  5. 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.

  6. waitb says:

    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.

  7. Legorie says:

    Have read “History repeats itself”, Oh! Boy, did I see it for myself.
    Thank you Carol for the wonderful blog.

  8. Eric West says:

    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.

  9. Tyler says:

    Thanks, this was making my maven tests fail.. heh

  10. lp says:

    Thanks for this post! This saved me!

  11. Sean Gilbertson says:

    This helped me a lot. I had the same problem with ANSICON, but it was preventing me from successfully building native extensions! THANK YOU!!

  12. Pingback: ¿Cómo que: “The system cannot find the path specified”? - David Martos @ SharePoint en Geeks.ms

  13. Venkat Avasarala says:

    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.

  14. Gary says:

    Yet another note of appreciation :) Thanks a bunch–it would have taken me forever to figure it out.

  15. Vipin says:

    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

  16. Sean says:

    Awesome, this pretty much saves the day for me :-)

  17. Jason says:

    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.

  18. Dirk says:

    Helped me too, thanks!

  19. Jonathan Nyquist says:

    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

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>