From: "Ara.T.Howard" Date: 2005-09-13T23:45:37+09:00 Subject: Re: find executables on windows On Tue, 13 Sep 2005, Kroeger Simon (ext) wrote: > You asked... > > at least on my system the Windows directory, SYSTEM and SYSTEM32 are > also in the PATH, so this will be ok in almost all cases I guess. > Depending what you are about to do I would suggest checking '.' also and > try other extensions than exe. My PATHEXT includes > > PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.RB;.RBW if was thinking more brute force: ... glob = File::join(dirname, basename) << '*' candidates = Dir[ glob ].select{|entry| File::executable? entry} return candidates.shift unless candidates.empty? ... since, afaik, PATHEXT does not imply some sort of ordering or precedecne. seem right? -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | Your life dwells amoung the causes of death | Like a lamp standing in a strong breeze. --Nagarjuna ===============================================================================