What is the find command in cmd?

Updated: 12/30/2021 by Computer Hope

What is the find command in cmd?

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.

  • Availability
  • Find syntax
  • Find examples

Find is an external command that is available for the following Microsoft operating systems as find.exe.

Find syntax

  • Windows Vista and later syntax
  • Windows XP and earlier syntax

FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]file name[ ...]]
/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.
/OFF[LINE] Do not skip files with offline attribute set.
"string" Specifies the text string to find.
[drive:][path]file name 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.

Windows XP and earlier syntax

FIND [/V] [/C] [/N] [/I] "string" [[drive:][path]file name[ ...]]
/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]file name 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.

Find examples

find /c "REM" c:\autoexec.bat

The example above 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 that any file would containing this string of text this would give you an accurate line count of the file.

find "hope" *.txt

The 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

  • See our find definition for further information and related links on this term.

What is the find command in cmd?
find

The ReactOS find command

Developer(s)Microsoft, IBM, DR, Datalight, Novell, Jim Hall, ReactOS ContributorsInitial releaseMarch 1983; 39 years ago (1983-03)Written inMS-DOS: x86 assembly language
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]

Overview

The 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]

Syntax

FIND [/V] [/C] [/N] [/I] "string" [[drive:][path]filename[...]]

Arguments:

  • "string" This command-line argument specifies the text string to find.
  • [drive:][path]filename Specifies a file or files in which to search the specified string.

Flags:

  • /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.

Note: If a pathname is not specified, FIND searches the text typed at the prompt or piped from another command.

Examples

C:\>find "keyword" < inputfilename > outputfilename

C:\>find /V "any string" FileName

See also

  • Findstr, Windows and ReactOS command-line tool to search for patterns of text in files.
  • find (Unix), a Unix command that finds files by attribute, very different from Windows find
  • grep, a Unix command that finds text matching a pattern, similar to Windows find
  • forfiles, a Windows command that finds files by attribute, similar to Unix find
  • Regular expression
  • List of DOS commands

References

  1. ^ Paterson, Tim (2013-12-19) [1983]. "Microsoft DOS V1.1 and V2.0: /msdos/v20source/FIND.ASM". Computer History Museum, Microsoft. Retrieved 2015-10-01.
  2. ^ Shustek, Len (2014-03-24). "Microsoft MS-DOS early source code". Software Gems: The Computer History Museum Historical Source Code Series. Retrieved 2015-10-01.
  3. ^ "Find - Search for text - Windows CMD - SS64.com". ss64.com.
  4. ^ Jamsa, Kris A. (1993), DOS: The Complete Reference, Osborne McGraw-Hill, p. 206, ISBN 0078819040.
  5. ^ "FlexOS User's Guide" (PDF). www.bitsavers.org. 1986. Retrieved 2020-09-14.
  6. ^ "Users guide". archive.org. Retrieved 2020-09-14.
  7. ^ "JaTomes Help - OS/2 Commands". Archived from the original on 2019-04-14. Retrieved 2019-07-20.
  8. ^ "Find". Archived from the original on 2017-08-26. Retrieved 2017-08-26.
  9. ^ "reactos/reactos". GitHub. 3 January 2022.
  10. ^ Wolverton, Van (2003). Running MS-DOS Version 6.22 (20th Anniversary Edition), 6th Revised edition. Microsoft Press. ISBN 0-7356-1812-7.
  11. ^ DR DOS 6.0 User Guide Optimisation and Configuration Tips
  12. ^ "Datalight ROM-DOS User's Guide" (PDF). www.datalight.com.
  13. ^ "ibiblio.org FreeDOS Package -- find (FreeDOS Base)". www.ibiblio.org.
  14. ^ "Equivalent of UNIX Grep command in Dos/Windows". January 26, 2009.

Further reading

  • Cooper, Jim (2001). Special Edition Using MS-DOS 6.22, Third Edition. Que Publishing. ISBN 978-0789725738.
  • Kathy Ivens; Brian Proffit (1993). OS/2 Inside & Out. Osborne McGraw-Hill. ISBN 978-0078818714.
  • Frisch, Æleen (2001). Windows 2000 Commands Pocket Reference. O'Reilly. ISBN 978-0-596-00148-3.
What is the find command in cmd?

  • Open source FIND implementation that comes with MS-DOS v2.0

Retrieved from "https://en.wikipedia.org/w/index.php?title=Find_(Windows)&oldid=1106169526"