  NAME
    which -- display full pathname for executable command

  SYNOPSIS
    which [options] [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. If the option is /ad or
    /d, which prints 'detail' information, i.e., date and file size.
  
    When used with the 'WHICHDETAILS' environment variable, the details
    options (/ad and /d) act as a toggle, disabling detailed output for
    that execution. To cause which to print details by default, simply
    'SET WHICHDETAILS=<value>', where <value> is anything you like. I
    use '1', as it is a single byte and saves valuable environment space.
    Feel free to use whatever you like, though; the only thing that's
    needed to make WHICHDETAILS work is for it to show up in the
    environment.

    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

    /ad
    -ad
                 Displays all executable files matching command that are
                 found in PATH, rather than just the first match. Includes
                 file size and date information for the executable. This
                 option cannot be used with other options

    /d
    -d
                 Displays first executable file matching command that is
                 found in PATH. Includes file size and date information for
                 the executable. 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
    WHICHDETAILS  Sets default behaviour to display file details (optional)

  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 files, 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		29 August 1999
