The FIND command is used to search for a text string in a file or files. After searching the specified files, FIND displays any lines of text that contain the string.
FIND [/V] [/C] [/N] [/I] "string" "filename1" "filename2" "filename ..."
If filename is not specified, FIND searches the text input from the "standard" source (usually the keyboard), a pipe, or a redirected file.
Wildcards (* and ?) are not accepted in filename. However, to search for string in a set of files, it is often possible to use the FIND command within a FOR loop structure.
If a DIR command output is piped to FIND, a list of files/directories whose names contain string will be displayed. There is no straightforward way to use DIR to make a list of files within which FIND will search for string.
Because inverted commas are used to delimit string, they cannot be used within string as part of the search pattern. To include inverted commas within string, it is necessary to use the "special character" of double inverted commas ("") which FIND interprets as inverted commas in the search string.
The FIND command does not accept carriage returns in the search string - nor will it recognize a string that has a carriage return embedded in it. For example, FIND does not report a match for the string "tax file" if "tax" and "file" happen to be on different lines because of word wrapping.
To display all lines from the file "pencil.ad" that contain the string "Pencil Sharpener":
If the string contains quotation marks, these must be doubled:
To search the current directory for the string "PROMPT" in all .BAT files:
To search your hard disk to find and display the filenames on drive C that contain the string "CPU", you can use the pipe "|" to direct the results of a DIR command to FIND:
Superscripts denote which same size files, if any, are identical (using FC).