Hide Comments
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, Aliases (including keystroke aliases), and files. 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


WHICH can also recognize Plugin commands, REXX files, EXTPROC files, and associated files.


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.






/ADisplay all matching commands. (Normally WHICH only displays the first match.)  Executable files will be displayed in the order they are found in the PATH.

Created with Help & Manual 6 and styled with Premium Pack Version 2.33 © by EC Software