Updated: 12/30/2021 by Computer Hope The find command lets you search for text within a file. Although MS-DOS is not case-sensitive, when typing in the string, you'll need to make sure you're using the correct case. Additionally, this command is used to find text in a file, not the actual file itself. If you want to search or find a file with a particular name, use the dir command. Tip If you're running Windows XP or later, consider using the improved findstr command.
Find is an external command that is available for the following Microsoft operating systems as find.exe. Find syntax
If a pathname is not specified, FIND searches the text typed at the prompt or piped from another command. Windows XP and earlier syntaxFIND [/V] [/C] [/N] [/I] "string" [[drive:][path]file name[ ...]]
If a pathname is not specified, FIND searches the text typed at the prompt or piped from another command. Find examplesfind /c "REM" c:\autoexec.batThe example above would find any "REM" statement in the autoexec.bat. find /v /c "&*fake&*" programs.txtList each line not containing "&*fake&*," because it's very unlikely that any file would containing this string of text this would give you an accurate line count of the file. find "hope" *.txtThe next example searches for any text file (.txt) containing the text hope in the current directory. As seen in the output below, the only file containing "hope" is the CH.TXT file. ---------- ACTIVE SETUP LOG.TXT ---------- CH.TXT computer hope ---------- MODEMDET.TXT ---------- OEWABLOG.TXT ---------- SCHEDLGU.TXT ---------- SETUPLOG.TXT
FreeDOS, ReactOS: COperating systemMS-DOS, PC DOS, FlexOS, SISNE plus, DR DOS, ROM-DOS, FreeDOS, 4690 OS, Windows, OS/2, eComStation, ArcaOS, ReactOSPlatformCross-platformTypeCommandLicenseMS-DOS: MIT FreeDOS, ReactOS: GPLv2+ In computing, find is a command in the command-line interpreters (shells) of a number of operating systems. It is used to search for a specific text string in a file or files. The command sends the specified lines to the standard output device.[1][2] OverviewThe find command is a filter to find lines in the input data stream that contain or don't contain a specified string and send these to the output data stream. It does not support wildcard characters.[3] The command is available in DOS,[4] Digital Research FlexOS,[5] IBM/Toshiba 4690 OS,[6] IBM OS/2,[7] Microsoft Windows,[8] and ReactOS.[9] On MS-DOS, the command is available in versions 2 and later.[10] DR DOS 6.0[11] and Datalight ROM-DOS[12] include an implementation of the find command. The FreeDOS version was developed by Jim Hall and is licensed under the GPL.[13] The Unix command find performs an entirely different function, analogous to forfiles on Windows. The rough equivalent to the Windows find is the Unix grep.[14] SyntaxFIND [/V] [/C] [/N] [/I] "string" [[drive:][path]filename[...]] Arguments:
Flags:
Note: If a pathname is not specified, FIND searches the text typed at the prompt or piped from another command. ExamplesC:\>find "keyword" < inputfilename > outputfilename C:\>find /V "any string" FileName See also
References
Further reading
External links
Wikibooks has a book on the topic of: Guide to Windows Commands
|