JSI Tip 7294. The Windows XP and Windows Server 2003 Where.exe utility.

When you use the Windows XP CMD help., or Windows Server 2003 CMD help, and press Where on the New command-line tools page, you see:

Where

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

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

NOTE: If Where.exe is missing from the %SystemRoot%\System32 folder of your Windows XP install, copy it from Windows Server 2003.



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish