Search PATH for a file

  • Thread starter Thread starter Branden
  • Start date Start date
B

Branden

Does anyone know of a command like "dir /s" to search for a file but which
will limit itself to search just the folders in the Path?

I am trying to figure out which file is being executed if the same .exe or
..cmd exists in various locations.

Thanks in advance,

branden ([email protected])
 
http://www.paulsadowski.com/WSH/cmdprogs.htm

Which.exe
Displays which copy of a file would be executed.
Which uses the PATH environment variable to determine which file would be
executed. Which also uses the PATHEXT variable if you do not specify an
extension to the file used in the argument.

Example:
C:\which which
..\which.exe

C:\which mywanip
c:\bin\mywanip.vbs
 
Branden said:
Does anyone know of a command like "dir /s" to search for a file but which
will limit itself to search just the folders in the Path?

I am trying to figure out which file is being executed if the same .exe or
.cmd exists in various locations.

Thanks in advance,

branden ([email protected])

For a batch only solution, see the help of for:
for /?

This finds the first occurence of the file.
for %I in (hh.exe) do @echo/%~dp$PATH:I

HTH
 
Back
Top