Can you please tell me what is Windows XP equivalent of “which” command in Linux? I have tired 'where', but it does not work on Windows XP.
4 Answers
There is no equivalent in Windows, but you can try one of these two substitutes:
http://nedbatchelder.com/code/utilities/wh_py.html (Click on "Download: wh.py")
or this guy created a script too:
http://pankaj-k.net/weblog/2004/11/equivalent_of_which_in_windows.html
- 25,519
- 5
- 48
- 72
-
1I just found this, which also had another answer, not accepted, but with a +50 score: http://stackoverflow.com/questions/304319/is-there-an-equivalent-of-which-on-windows – KCotreau Jul 20 '11 at 19:24
There are several possibilities that you can choose from:
- Use a true POSIX
whichcommand. The SFUA utility toolkit, whose tools run in the Subsystem for UNIX-based Applications that comes right there in the box with Windows 7 Ultimate edition and Windows Server 2008 R2 (For Windows XP, one can download and install Services for UNIX version 3.5.), has awhichcommand, along with some 300 other POSIX tools. Its Korn shell also has thetypebuilt-in command, which of course understands the shell's own aliases.It comes in both x86-64 and IA64 flavours as well as x86-32. The programs run in Windows' native proper POSIX environment, rather than with emulator DLLs (such as
cygwin1.dll) layering things over Win32. - Use a Win32 port of
which. Oft-mentioned are GNUWin32, cygwin, and unxutils. - Use a replacement command interpreter and use its built-in facilities. JP Software's TCC/LE is one such. It has a built in
WHICHcommand, which understands TCC's aliases and executable extensions.
- 26,613
- 1
- 72
- 103
A bit overkill, but for completeness: Cygwin will give you which on Windows.
- 31,057
- 6
- 55
- 80
This is actually answered on SE, in great detail:
https://stackoverflow.com/questions/304319/is-there-an-equivalent-of-which-on-windows
Maybe it should be merged to Superuser, instead marked off topic on that site.