Where Command In Windows Server 2008

In this article I am going to explain about where Command in Windows Server 2008 and also explain it's related syntax.
  • 1231

Introduction

It is used to displays the location of files that match the assign search pattern.

Syntax

where [/r <Dir>] [/q] [/f] [/t] [$<ENV>:|<Path>:]<Pattern>[ ...]

 

 Parameter  Description
/r <Dir> Indicates a recursive search, starting with the specified directory.
/q  
Returns an exit code (0 for success, 1 for failure) without displaying the list of matched files.
/f   Displays the results of the where command in quotation marks.
/t Displays the file size and the last modified date and time of each matched file.
[$<ENV>:|<Path>:]<Pattern>[ ...] Specifies the search pattern for the files to match. At least one pattern is required, and the pattern can include wildcard characters (* and ?). By default, where searches the current directory and the paths that are specified in the PATH environment variable. You can specify a different path to search by using the format $ENV:Pattern (where ENV is an existing environment variable containing one or more paths) or by using the format Path:Pattern (where Path is the directory path you want to search). These optional formats should not be used with the /r command-line option.
/? Displays help at the command prompt.


Example

It is used to
find all files named Test in drive C  and its subdirectories, type:

where /r c:\ test

It is used to make list of all files in the Public directory, type:

where $public:*.*

It is used to find all files named Notepad in drive C of the remote computer and its subdirectories, type:

where /r \\computer1\c notepad.*

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.