
  NAME
    which -- display full pathname for executable command

  SYNOPSIS
    which [/? | --help | /v | --version | /a | -a] [command ...]

  DESCRIPTION
    DOS uses the PATH environment variable to determine which directories
    to search when attempting to execute a program. For each command
    specified, which searches directories defined in PATH and prints the
    name of the first executable file that matches command. When /a or -a
    is specified on the command line, which returns all executables
    found in PATH that match the command name.

    Typically, one would not specify the file extension of a command to
    search for; doing so limits the search to that specific file name.
    In such a limited search, it's possible that which would return the
    name of an executable that is farther down the PATH than the actual
    file that is being executed. For example, if you have TEST.COM,
    TEST.EXE, and TEST.BAT all residing in the current directory, specifying
    TEST.BAT on the command line would cause which to report that TEST.BAT
    is being executed when, in fact, TEST.COM is the program being run. A
    better way is to simply search for TEST unless you really need to
    find an executable with a specific extension.
  
    In keeping with the execution order used by DOS, which displays COM
    files first, followed by EXE files, and then BAT files (for searches
    that do not have the extension specified). which searches the current
    directory before searching the directories defined in PATH.

  OPTIONS
    which accepts the following options:

    /?
    --help
                 Displays a short summary of how to use the program. When
                 this switch is in the first position on the command line,
                 which ignores all other command-line entries and displays
                 help information

    /v
    --version
                 Displays version and licensing information. When this
                 switch is in the first position on the command line, which
                 ignores all other command-line entries and displays
                 version information

    /a
    -a
                 Displays all executable files matching command that are
                 found in PATH, rather than just the first match. This
                 option cannot be used with other options

  ENVIRONMENT VARIABLES
    which uses the following environment variables:

    PATH         The list of directories to search for command

  DIAGNOSTICS
    Possible exit values are:

    0    Success:
             -- An executable file matching command was found
             -- Help or version information was displayed
    1    Failure due to the following:
             -- A matching executable file could not be found
             -- Invalid command-line option

  NOTE
    This command has no way of knowing about COMMAND.COM internal commands
    and, therefore, is unable to help you resolve such conflicts. Under
    DOS, COMMAND.COM executes internal commands before searching PATH to
    find the executable being called.

    If which is searching for multiple files and is able to locate one or
    more, the exit value will be 0 even if other commands are not found.
    Only the first position on the command line is tested for options; all
    other entries will be treated as filenames.

  BUGS
    Oh, probably.

  AUTHOR
    Trane Francks <trane@twh.gol.com>

    I prefer being contacted via e-mail; however, you can snail-mail me at:

	Trane Francks
	Sento Hills Tsurukawa #305
	1856-4 Kanai-cho, Machida City
	Tokyo 195-0071
	JAPAN
 

  DOS Extensions		24 August 1998
