As I sometimes have path problems, where one of my own cmd scripts is hidden (shadowed) by another program (earlier on the path), I would like to be able to find the full path to a program on the Windows command line, given just its name.
Is there an equivalent to the UNIX command 'which'?
On UNIX, which command
prints the full path of the given command to easily find and repair these shadowing problems.
I have created tool similar to Ned Batchelder:
Searching .dll and .exe files in PATH
While my tool is primarly for searching of various dll versions it shows more info (date, size, version) but it do not use PATHEXT (I hope to update my tool soon).
None of the Win32 ports of Unix which that I could find on the Internet are satistactory, because they all have one or more of these shortcomings:
So I eventually wrote my own which, that suports all the above correctly.
Available there: http://jf.larvoire.free.fr/progs/which.exe
I have used the
which
module from npm for quite a while, and it works very well: https://www.npmjs.com/package/which It is a great multi platform alternative.Now I switched to the
which
that comes with Git. Just add to your path the/usr/bin
path from Git, which is usually atC:\Program Files\Git\usr\bin\which.exe
. Thewhich
binary will be atC:\Program Files\Git\usr\bin\which.exe
. It is faster and also works as expected.You can first install Git from Downloading Git, and then open Git Bash and type:
TCC and TCC/LE from JPSoft are CMD.EXE replacements that add significant functionality. Relevant to the OP's question,
which
is a builtin command for TCC family command processors.Not in stock Windows but it is provided by Services for Unix and there are several simple batch scripts floating around that accomplish the same thing such this this one.