Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2


Locates and displays all of the files that match the given parameter. By default, the search is done in the current directory and in the PATH environment variable.


where [/r Dir] [/q] [/f] [/t] Pattern ...

  • /r Dir
    Indicates a recursive search, starting with the specified Dir directory.
  • /q
    Returns either an exit code of 0 for success or 1 for failure without displaying the files.
  • /f
    Displays the output file name in quotation marks.
  • /t
    Displays the size, time stamp, and date stamp of the file.
  • Pattern
    Specifies the name of a directory, file, or set of files to be found. You can use wildcard characters (that is, ? or *).
  • /?
    Displays help at the command prompt.
  • Where can run recursive searches, display file information such as date or size and can accept environment variables in place of paths on local computers.

To find all directories named Program Files in the current directory and path of the current computer, type:

where "program files"

To find all files named Test in drive C: of the current computer and its subdirectories, type:

where /r c:\ test

To find all files named Notepad in drive C: of the remote computer Computer1 and its subdirectories, and report the executable type for executable files, type:

where /r \\computer1\c /e notepad.*

Formatting legend

Format Meaning


Information that the user must supply


Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

See Also


Using command redirection operators
Command-line reference A-Z
Command shell overview