Command: find
FIND displays lines in one or more text files that contain a string.
Syntax:
FIND [ /C ] [ /I ] [ /N ] [ /V ] "string" [[drive][path]file1]
FIND [/?]
drive The drive letter, e.g. C:
path The directory, e.g. \example\
file1 The file(s) you wish to search, e.g. test.exe
Note: If you do not specify a file, find will take
input from the console. Type Ctrl-Z to finish.
"string" The string of signs you want to find, e.g. "water" or
"0123". The string must be marked by quotation marks.
Options:
/C Only displays a count of the matching lines.
/I Ignore case during the comparison ("cAsE").
/N Number the displayed lines, starting at 1.
/V Inverts the search: displays lines that do NOT
contain the string.
/? Shows the help.
Comments:
FIND supports NLS (national language support) and DOSLFN
FIND has the following EXITCODES (ERRORLEVEL):
0 found
1 none found
2 other errors, e.g. syntax errors
Examples:
find /C "set" c:\fdauto.bat finds results for "set"
find /C "SET" c:\fdauto.bat finds NO results for "SET"
find /C /I "sEt" c:\fdauto.bat finds results for "set" and "SET".
See also:
doslfn
exitcode/errorlevel
xgrep
Copyright © 2004 Robert Platt, updated 2011 and 2022 by W. Spiegl.
This file is derived from the FreeDOS Spec Command HOWTO.
See the file H2Cpying for copying conditions.