Home NT Commands
NT Syntax

WHERE (2K Resource Kit / .Net Server)

Locate and display files in a directory tree.

The WHERE command is roughly equivalent to the UNIX 'which' command.
For early versions of windows that don't have this command you can use this WHICH batch file.

By default, the search is done in the current directory and in the PATH.

syntax
      WHERE [/r Dir] [/q] [/f] [/t] Pattern ...

key
   /r      A recursive search, starting with the specified Dir directory.

   /q      Don't display the files but return either an exit code of 0 for success
           or 1 for failure.

   /f      Display the output file name in quotation marks.

   /t      Display the size, time stamp, and date stamp of the file.

   /e      Report the executable type.

  pattern  The name of a folder, file, or set of files to be found.
           you can use wildcard characters ( ? * ) and UNC paths.

examples

To find all files named 'Zappa' in drive C: (including subdirectories)
WHERE /r c:\ Zappa

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

WHERE /r \\MyPC\c /e Zappa.*


Related commands:

CD - Change Directory

Equivalent Linux BASH commands:

which - Show full path of commands



Simon Sheppard
SS64.com