which
This tool locates executable files on the PATH
. And it does a lot more. It can be used to determine which executable
Windows will call, when multiple copies exist.
Usage
C:\...\>which.exe /? which - Version 4.0 Freeware written by Gerson Kurz (http://p-nand-q.com) USAGE: which.EXE [OPTIONS] FILE {FILE}. OPTIONS: /EXTENSION: search for extension, can be a ; separated list /DIR: add directory , can be a ; separated list /RECURSIVE: search directories recursively /SINGLE: stop after the first find result /ENV: environment variable, defaults to PATH FILE {FILE}: one or more files to find
Examples
To find notepad on the path, try:
C:\...\>which notepad which - Version 4.0 Freeware written by Gerson Kurz (http://p-nand-q.com) C:\Windows\notepad.exe [22.08.2013 13:00:12, 217600 bytes] C:\Windows\SysWOW64\notepad.exe [22.08.2013 05:35:48, 208896 bytes] C:\Windows\system32\notepad.exe [22.08.2013 13:00:12, 217600 bytes]
Note: You can see from this that on a x64 system, which
will show you both 32-bit and 64-bit variants if possible.
Developers will love that which
also knows about the environment variables INCLUDE
and LIBS
. For example, try this:
C:\...\>which windows.h which - Version 4.0 Freeware written by Gerson Kurz (http://p-nand-q.com) C:\Program Files (x86)\Windows Kits\8.0\include\um\Windows.h [02.08.2013 17:56:14, 6630 bytes]
You can also use which
to list all DLLs starting with "TA" on your path:
C:\...\>which ta*.dll which - Version 4.0 Freeware written by Gerson Kurz (http://p-nand-q.com) C:\Windows\SysWOW64\tapi3.dll [22.08.2013 05:46:31, 846336 bytes] C:\Windows\SysWOW64\tapi32.dll [22.08.2013 05:42:27, 196608 bytes] C:\Windows\SysWOW64\TapiMigPlugin.dll [22.08.2013 05:38:33, 44032 bytes] C:\Windows\SysWOW64\tapiperf.dll [22.08.2013 06:04:40, 10240 bytes] C:\Windows\SysWOW64\tapisrv.dll [22.08.2013 05:33:38, 248320 bytes] ... (lots more omitted here)
Download
- Starting with version 3.0,
which
is part of gtools, which you can download here.. - The sourcecode is hosted on code.google.com.
License
which is freeware, BSD-licensed.
History
- Version 4.0 - Feb 16, 2014
- Fixed a couple of minor bugs
- Version 3.2
- Minor bugfixes
- Version 3.1
- Starting with version 3.1, you can write arguments in any order you like:
which filename /DIR m:\
is now exactly the same aswhich filename /DIR m:\
. - Minor bug fixes
- Starting with version 3.1, you can write arguments in any order you like:
- Version 3.0
- First public release.
GK, Feb 16, 2014