FIND

Searches for a text string in one or more files. For a command with more functionality, see FINDSTRFINDSTR.

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

Where:

  • /V - Displays lines not containing the specified string.
  • /C - Displays only the count of lines containing the string (this function is not present in the FINDSTR command).
  • /N - Shows the numbers of the displayed lines.
  • /I - Ignores case when searching for string.
  • /OFF[LINE] - Does not ignore files that have the "offline" attribute set.
  • "string" - Specifies the text string to search for.
  • [drive:][path]filename - Specifies one or more files to search for the string.

If no path is specified, searches for the string in the current command prompt or in redirected input from another command.

Examples:

1. Search for the string del C:\banana.txt in the file C:\Documents and Settings\peach.bat ignoring case:

find /i "del C:\banana.txt" "C:\Documents and Settings\peach.bat"

 

2. Count the number of occurrences of the string bighello in the file some_messages.rtf ignoring case:

find /c /i "bighello" some_messages.rtf

Comments