Last updated
Which: show the full path of (shell) commands
$ winget install --id GnuWin32.Which --exact --version 2.20Run in Command Prompt, PowerShell, or Windows Terminal. Prompts for any agreements.
For IT teams
App deployment, patching, and remote support in one place. Push this app to every device you manage, keep it patched automatically, and see new CVEs the moment they land. Works with Intune or fully standalone.
Sign up freeFree for up to 5 devices.
Which takes one or more arguments. For each of its arguments it prints to stdout the full path
of the executables that would have been executed when this argument had been entered at the shell prompt.
It does this by searching for an executable or script in the directories listed in the environment
variable PATH using the same algorithm as bash.
The GnuWin32 port of Which searches for a matching file in the following sequence of directories:
- The current directory.
- The directories that are listed in the PATH environment variable.
If the filename given on the command line cannot be found in any of the above directories,
the search is repeated with the extensions given in the environment variable PATHEXT until a match occurs.
If PATHEXT is empty or does not exist, a value of ".com;.exe;.bat;.cmd" is assumed.
| Architecture | Type | Scope | Install | Download |
|---|---|---|---|---|
| x86 | Portable | - | Direct |
Copy a command tailored to that specific architecture, type, and scope - useful when winget would otherwise pick a different default.
No known CVEs for Which for Windows.
Coverage is best-effort and depends on a winget package mapping to an NVD CPE entry. Absence here is not a guarantee of safety.
More from GnuWin32.