From: "Kroeger Simon (ext)" Date: 2005-09-13T23:25:25+09:00 Subject: Re: find executables on windows > -----Original Message----- > From: Ara.T.Howard [mailto:Ara.T.Howard@noaa.gov] > Sent: Tuesday, September 13, 2005 4:18 PM > To: ruby-talk ML > Subject: Re: find executables on windows > > On Tue, 13 Sep 2005, Kroeger Simon (ext) wrote: > > > MSDN, CreateProcess: > > > > ...If the filename does not contain a directory path, the system > > searches > > for the executable file in the following sequence: > > > > - The directory from which the application loaded. > > > > - The current directory for the parent process. > > > > - Windows 95 and Windows 98: The Windows system directory. > > Use theGetSystemDirectory function to get the path of > this directory. > > > > - Windows NT: The 32-bit Windows system directory. > > Use the GetSystemDirectory function to get the path of this > > directory. > > The name of this directory is SYSTEM32. > > > > - Windows NT: The 16-bit Windows system directory. > > There is no Win32 function that obtains the path of this > directory, > > but it is searched. The name of this directory is SYSTEM. > > > > - The Windows directory. Use theGetWindowsDirectory > function to get the > > > > path of this directory. > > > > - The directories that are listed in the PATH environment variable. > > > > erm, yes, that's it! :) > > i think i'll settle for PATH ;-) > 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 So this may be important, at least if you don't know the complete filename beforehand. cheers Simon