WHERE (2K Resource Kit / Windows 2003)

Locate and display files in a directory tree.

The WHERE command is roughly equivalent to the UNIX 'which' command. 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.

As an alternative to this command you can use this 90-character batch file:

@for %%e in (%PATHEXT%) do @for %%i in (%1%%e) do @if NOT "%%~$PATH:i"=="" echo %%~$PATH:i

(from the OldNewthing blog)

Examples

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

Find all files named 'Zappa' on the remote computer 'Server1' searching its subdirectories, and reporting the executable type for executable files

WHERE /r \\Server1\Share1 /e Zappa.*

"Who never walks, save where he sees men's tracks, makes no discoveries" - Josiah Gilbert Holland

Related:

CD - Change Directory
TYPE - Display the contents of a text file
Equivalent bash command (Linux): which - Show full path of commands



Back to the Top

Simon Sheppard
SS64.com