which

NAME

which - Windows command-line utility to locate a command

SYNOPSIS

which [-a] command...

DESCRIPTION

The which(1w) Windows utility displays the full path for executable commands (.exe or .com files) and dynamic-link libraries (.dll files).

If the user does not specify an extension in command, which first appends ".exe" to command and searches in the directories listed by the PATH environment variable. If the search fails, the above procedure is repeated for the extensions .com and then .dll.

OPTIONS

The which utility supports the following option:

-a
Displays all matching files from every directory in the PATH environment variable, not just the first match. This helps reveal conflicts between two files of the same name.

ARGUMENTS

The which utility supports the following argument:

command
Specifies the command or dynamic-link library whose full path is to be displayed.

DIAGNOSTICS

Possible exit-status values are:

0
Successful completion
1
Failure

EXAMPLES

Assume PATH = c:\system\temp;c:\system;c:\...

Assume that test.exe is present in both c:\system\temp and c:\system, and that test.dll is present in c:\system.

The following illustrates a few commands and the corresponding results:

which test.exe
C:\system\temp\test.exe
which -a test.exe
C:\system\temp\test.exe

C:\system\test.exe

which test
C:\system\temp\test.exe
which -a test
C:\system\temp\test.exe

C:\system\test.exe

C:\system\test.dll