Name

findstr

Synopsis

findstr [options] /C:string | /G:file | strings [files]

Search for one or more text strings or regular expressions in the specified files or in standard input (if no files are given), and display matching lines. Enclose multiple search strings in quotation marks.

Options

/R

Interpret search strings as regular expressions.

/L

Interpret search strings as literal text.

/C:string

Designate the specified string as a literal text string (useful for strings with internal spaces).

/G: file

Read the search strings from the specified file. A slash for file says to read the filename from the console.

/B | /E

Match the search string only at the beginning ( /B ) or end ( /E ) of a line (don’t include both).

/I

Perform a case-insensitive search.

/V

Display nonmatching lines.

/X

Display only lines that match exactly.

/N | /O

Precede displayed lines with their line numbers or character offsets, respectively.

/M

Display only the names of files containing a match.

/S

Recurse subdirectories in the file list.

/F: file

Read the file list from the specified file. A slash for file says to read the file list from the console.

/D:dirlist

Search the files in the comma-separated directory list.

/P

Skip files containing nonprintable characters.

Regular Expression Components

.

Any single character.

^ $

Beginning /end of line.

\< | \>

Beginning /end of word.

\x

Literal character: used to escape special characters in regular expressions (e.g., \$ refers to a literal dollar sign).

[chars]

Any character in the list.

[^chars]

Any character ...

Get Windows 2000 Commands Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.