Name

find — \Windows\Command\find.exe

Synopsis

After searching the specified files, find displays any lines of text that contain the string you've specified for your search. find is useful for searching for specific words (strings) in files, but don't get it confused with Start Search For Files or Folders, which is capable of searching for text, files, directories, etc., and has many other capabilities that the find command doesn't have. The find options are:

find [/v] [/c] [/n] [/i] [/offline] "string" 
   [filename[ ...]]

Option

Description

" string "

The text to look for, enclosed in quotation marks.

filename

The file(s) in which to search. Although wildcards (*, ?) are not supported, multiple filenames can be specified as long as they are separated with commas. If filename is omitted, find searches text typed at the prompt or piped from another command via the pipe character (|).

/c

Displays only the count of lines containing the string.

/i

Ignores the case of characters when searching for the string.

/n

Displays line numbers with the displayed lines.

/v

Displays all lines not containing the specified string.

/offline

Include files with the offline attribute set (that otherwise would be skipped).

Examples

find "redflag" myexployees.txt
find /c "deceased" myexployees.txt
for %f in (*.bat) do find "cls" %f >> cls.txt

Get Windows XP Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.