Search PATH for a file

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])
 
P

Paul R. Sadowski

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
 
M

Matthias Tacke

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top