Microsoft DOS find command
Quick links
About find
Availability
Syntax
Examples
About find
Allows you to search for text within a file. Although MS-DOS itself is not case sensitive, when typing in the string that you are looking for with the find command, it is case sensitive.
Additionally, this command is used to find text within a file, not the actual file itself. If you are wanting to search or find a file with a particular name, use the dir command.
Users who are running Microsoft Windows 2000 or Windows XP should also consider using the improved findstr command.
Availability
The find command is an external command that is available in the below Microsoft operating systems.
All Versions of MS-DOS
Windows 95
Windows 98
Windows ME
Windows NT
Windows 2000
Windows XP
Windows Vista
Windows 7
Syntax
Searches for a text string in a file or files.
FIND [/V] [/C] [/N] [/I] "string" [[drive:][path]filename[ ...]]
| /V |
Displays all lines NOT containing the specified string. |
| /C |
Displays only the count of lines containing the string. |
| /N |
Displays line numbers with the displayed lines. |
| /I |
Ignores the case of characters when searching for the string. |
| "string" |
Specifies the text string to find. |
| [drive:][path]filename |
Specifies a file or files to search. |
If a pathname is not specified, FIND searches the text typed at the prompt or piped from another command.
Examples
find /c "REM" c:\autoexec.bat
The above example would find any "REM" statement in the autoexec.bat.
find /v /c "&*fake&*" programs.txt
List each line not containing "&*fake&*", because it's very unlikely any file would contain this string of text this would give you an accurate line count of the file.
find "tutorial" *.txt
Next this example searches for any text file (.txt) that contains the text tutorial in the current directory. Below is an example of the output you may see. As can be seen from the below example the only file that contains tutorial is the ST.TXT file.
---------- ACTIVE SETUP LOG.TXT
---------- ST.TXT
shine tutorial
---------- MODEMDET.TXT
---------- OEWABLOG.TXT
---------- SCHEDLGU.TXT
---------- SETUPLOG.TXT |