Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Specifying which file to run with duplicates in %PATH%


  • Please log in to reply
1 reply to this topic

#1 johnson_123

johnson_123

  • Members
  • 62 posts
  • OFFLINE
  •  
  • Local time:11:34 AM

Posted 15 April 2015 - 10:23 PM

Is it possible to specify which version of a file to call when there are duplicates of it on your PATH variable?

Background

I have both mingw32 and mingw64's bin folders on my path such that

PATH=...;C:\mingw32\bin;C:\mingw64\bin;...

 

and each folder contains the gcc, g++ etc. executables. is it possible to specify which one should be called, other than to prepend the specific one i want to the start of the path like

PATH=C:\mingw64\bin;%PATH%

 

for dll's that live in the folder, the 32 or 64bit dll seems to be loaded correctly from windows own methods, but as for other operations im unsure how / (or even) if this is possible.



BC AdBot (Login to Remove)

 


#2 jcgriff2

jcgriff2

  • BSOD Kernel Dump Expert
  • 1,109 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:New Jersey Shore
  • Local time:02:04 AM

Posted 16 April 2015 - 12:53 AM

Each folder in the PATH statement starting from the beginning is checked for the app's name - when found, it will execute it from the first folder it is found in.  A same-named executable contained in a subsequent directory in the PATH statement will never be executed. 

 

I don't know of any way around this except by specifying the folder name along with the executable name.


Edited by jcgriff2, 16 April 2015 - 12:53 AM.

Microsoft MVP 2009-2015
Microsoft Windows Insider MVP 2018 - Present




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users