Which for Windows logo

Which for Windows GnuWin32

Use this command to install Which for Windows:
winget install --id=GnuWin32.Which -e

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.

Which for Windows: A Command-Line Utility for Path Resolution

Primary Purpose
Which for Windows is a command-line utility designed to determine the full paths of executables by simulating shell behavior. It searches through directories specified in the PATH environment variable and considers file extensions from PATHEXT, mimicking bash-like path resolution.

Key Features

  • Accurately resolves executable paths using the PATH and PATHEXT environment variables.
  • Searches the current directory and all directories listed in PATH for matching executables.
  • Outputs absolute paths of found executables, facilitating script debugging and automation tasks.

Audience & Benefit
Ideal for developers, system administrators, and anyone requiring precise executable path resolution on Windows, Which for Windows helps ensure the correct executable is run and aids in troubleshooting path-related issues.

This utility can be installed via winget, making it easy to integrate into your workflow.

Versions
2.20