|Purpose:||Display the command type and what it would execute|
|Format:||WHICH [/A] command [command ...]|
|command||One or more commands or files.|
WHICH displays information about internal and external commands, library functions, Aliases (including keystroke aliases), files, plugin variables, internal variables, variable functions, and user-defined variable functions. When a file matches an applicable Executable Extension or Windows File Association, that data will be displayed. The exact information reported depends on the type of command or file you specify. For example:
[c:\] which cdd buildtree notepad test.btm test.exe test.xyz test.doc donothing
CDD is an internal command
buildtree is an alias : cdd /s
notepad is an external: C:\windows\notepad.exe
test.btm is a batch file : C:\test.btm
test.exe is an external : C:\test.exe
test.xyz is an executable extension : C:\path\mybatch.btm C:\test.xyz
test.doc is associated with : C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE
donothing is an unknown command
If the command is an abbreviated alias, WHICH will display the full name; i.e.:
[c:\] alias opt*ions=*option
[c:\] which opt
opt*ions is an alias : *option
A leading * will skip the alias test (i.e., if dir is an alias, *dir will return the internal command).
Note: WHICH does not support wildcard specifications unless you use the /A option. Parameters must be actual commands or actual file names (including variable and function references as in "which %comspec"). If a filename includes white space or special characters, it must be enclosed in double quotes. A file specified without an explicit path must be on the current PATH.
See Executable Files and File Searches for details on the order in which various locations are searched.
|/A||Display all matching names. (Normally WHICH only displays the first match.) Executable files will be displayed in the order they are found in the PATH.|