Posted On 2007-04-25 by FortyPoundHead
Keywords: Command Reference 2K Resource Kit / .Net Server
Tags: Windows Commandline Windows
Views: 1514

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.

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

/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.*

About the Author

has posted a total of 1974 articles.

Comments On This Post

No comments on this post yet!

Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.

Your IP address is:

Before you can post, you need to prove you are human. If you log in, this test goes away.

Code Links