up vote 1 down vote favorite
share [g+] share [fb]

I remembered that I used a tool called as where to find locations for any executable programs like this in a console:

 C:\Tmp\Where myTool.exe
 C:\Program Files\MyApp\myTools.exe
 ....

Now I cannot find this tool. Not sure if Windows has a build-in tool to do that finding?

link|improve this question

48% accept rate
IF the application is running & you need to know its location, use Process Explorer( from Sys Internals). – Ganesh R. Sep 30 '09 at 17:19
feedback

6 Answers

up vote 2 down vote accepted

I think you may be thinking of the which command in Linux.

$ which bash
/bin/bash

I'm not aware of an equivalent tool in Windows.

EDIT: I just remembered that there's a package called Unix Utils for Windows that would provide this functionality for you.

link|improve this answer
feedback

use dir:

cd \
dir /s /b mytool.exe

the cd \ part changes you to the root of the drive, to ensure searching starts at the top of the hierarchy.

link|improve this answer
It seems like doing a command line Windows Search. – Ganesh R. Sep 30 '09 at 17:18
1  
That does a recursive search of the drive and would take forever. – djhowell Sep 30 '09 at 17:19
The only way to find executables that AREN'T in the PATH environment variable is to do this. He never specified his path, he said any executable. – John T Sep 30 '09 at 17:31
feedback

Frustrating that it's not built-in as a simple command.

However, there are several solutions, one of which is a batch file.

Create a batch file (which.bat) as follows:

@setlocal
@set P2=.;%PATH%
@for %%e in (%PATHEXT%) do @for %%i in (%~n1%%e) do @if NOT "%%~$P2:i"=="" echo %%~$P2:i

This looks in the local directory, will take a filename parameter with or without an extension, and return the first match from the current directory or in the PATH.

Then run it like which cmd.exe to find the cmd.exe that will execute if you type in cmd.

link|improve this answer
feedback

Various answers over on Stack OverFlow

link|improve this answer
feedback

On windows you can use the free utility Everything search engine to search instantly for any file by full or partial name (if your hard disk is formatted in ntfs).

link|improve this answer
feedback

If you just want which, the GnuWin32 project has a bunch of unix utils with individual installers.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.