If two separate PATH directories contain a same-named executable, how does Windows choose?

Posted by Coldblackice on Super User See other posts from Super User or by Coldblackice
Published on 2012-11-16T08:37:41Z Indexed on 2012/11/16 11:05 UTC
Read the original article Hit count: 303

Filed under:
|
|
|

I'm in the process of upgrading PEAR (PHP) on my system. The upgrade script is encouraging me to add "..\PHP\PEAR" to my PATH so that I can use "pear.bat". However, I already am able to use pear.bat.

Looking in my PATH, I see that I don't have any PEAR directories, only my PHP directory. Opening my PHP directory, I see that there's a "pear.bat" in the base. But there's also a pear.bat in the PEAR subfolder of PHP. I'm wondering if I borked a PEAR install.

I digress. So if I leave ..\PHP in my path, but also add ..\PHP\PEAR -- both of which have a "pear.bat" in them -- which one will Windows "choose"? How does Windows decide?

© Super User or respective owner

Related posts about Windows

Related posts about configuration