Cross-platform which command for locating executables in PATH.
go build
which <program>
Prints the full path to the executable if found in PATH. Returns exit code 1 if not found.
$ which go
/usr/local/go/bin/go
$ which notepad
C:\Windows\System32\notepad.exe
- On Windows, automatically searches for files with PATHEXT extensions (.exe, .bat, .cmd, etc.)
- On Windows, also checks the current directory
- On Unix, checks execute permissions
GPL-2.0