Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
FIND--Examples
◄Syntax► ◄Notes►
────────────────────────────────────────────────────────────────────────────
FIND──Examples
To display all lines from the file PENCIL.AD that contain the string "Pencil
Sharpener", type the following command:
find "Pencil Sharpener" pencil.ad
To find a string that contains text within quotation marks, you must enclose
the entire string in quotation marks and, in addition, use two quotation
marks for each quotation mark contained within the string, as shown in the
following example:
find "The scientists labeled their paper ""for discussion only."" It is
not a final report." report.doc
If you want to search for a set of files, you can use the FIND command with
the FOR command. The following command uses this method to search the
current directory for files that have the extension .BAT; in each file
found, the command searches for the string "PROMPT":
for %f in (*.bat) do find "PROMPT" %f
Suppose you want FIND to search your hard disk to find and display the
filenames on drive C that contain the string "CPU". To do this, you can use
the pipe (|) to direct the results of a DIR command to FIND, as shown in the
following example:
dir c:\ /s /b | find "CPU"
Before using a pipe for redirection, you should set the TEMP environment
variable in your AUTOEXEC.BAT file.
Since FIND searches are case-sensitive and since DIR produces uppercase
output, you must either type the string "CPU" in uppercase letters or use
the /I switch with FIND.
♦