Computer and Software Support


Where

This page is from Microsoft

Updated: January 21, 2005

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.
 
 
Syntax
where [/r Dir] [/q] [/f] [/t] Pattern ...
Parameters
/rDir
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.
Remarks
  • 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.
Examples
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
Italic Information that the user must supply
Bold 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