Findstr
   HOME

TheInfoList



OR:

In
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, e ...
, is a
command Command may refer to: Computing * Command (computing), a statement in a computer language * COMMAND.COM, the default operating system shell and command-line interpreter for DOS * Command key, a modifier key on Apple Macintosh computer keyboards * ...
in the
command-line interpreter A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
s ( shells) of
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
and
ReactOS ReactOS is a free and open-source operating system for amd64/i686 personal computers intended to be binary-compatible with computer programs and device drivers made for Windows Server 2003 and later versions of Windows. ReactOS has been noted a ...
. It is used to search for a specific
text string In computer programming, a string is traditionally a sequence of characters, either as a literal constant or as some kind of variable. The latter may allow its elements to be mutated and the length changed, or it may be fixed (after creation). ...
in
computer file A computer file is a computer resource for recording data in a computer storage device, primarily identified by its file name. Just as words can be written to paper, so can data be written to a computer file. Files can be shared with and transfe ...
s.


Overview

The command sends the specified lines to the
standard output In computer programming, standard streams are interconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin ...
device. It is similar to the
find Find, FIND or Finding may refer to: Computing * find (Unix), a command on UNIX platforms * find (Windows), a command on DOS/Windows platforms Books * ''The Find'' (2010), by Kathy Page * ''The Find'' (2014), by William Hope Hodgson Film and tel ...
command. However, while the find command supports
UTF-16 UTF-16 (16-bit computing, 16-bit Unicode Transformation Format) is a character encoding capable of encoding all 1,112,064 valid code points of Unicode (in fact this number of code points is dictated by the design of UTF-16). The encoding is variab ...
, findstr does not. On the other hand, findstr supports
regular expression A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or ...
s, which find does not. The findstr program was first released as part of the
Windows 2000 Windows 2000 is a major release of the Windows NT operating system developed by Microsoft and oriented towards businesses. It was the direct successor to Windows NT 4.0, and was Software release life cycle#Release to manufacturing (RTM), releas ...
Resource Kit Resource Kit is a term used by Microsoft for a set of software resources and documentation released for their software products, but which is not part of that product. Resource kits offer supplementary resources such as technical guidance, compatibi ...
under the name qgrep. findstr cannot search for null bytes commonly found in
Unicode Unicode, formally The Unicode Standard,The formal version reference is is an information technology Technical standard, standard for the consistent character encoding, encoding, representation, and handling of Character (computing), text expre ...
computer files.Findstr - Search for strings - Windows CMD - SS64.com
/ref>


Syntax

FINDSTR flags strings rive:path]filename .. Arguments: *flags This can be any combination of flags described below. *strings Text to be searched for. * rive:path]filename Specifies a file or files to search. Flags: */B Matches pattern if at the beginning of a line. */E Matches pattern if at the end of a line. */L Uses search strings literally. */R Uses search strings as regular expressions. */S Searches for matching files in the current directory and all subdirectories. */I Specifies that the search is not to be case-sensitive. */X Prints lines that match exactly. */V Prints only lines that do not contain a match. */N Prints the line number before each line that matches. */M Prints only the filename if a file contains a match. */O Prints character offset before each matching line. */P Skip files with non-printable characters. */OFF
INE INE, Ine or ine may refer to: Institutions * Institut für Nukleare Entsorgung, a German nuclear research center * Instituto Nacional de Estadística (disambiguation) * Instituto Nacional de Estatística (disambiguation) * Instituto Nacional Elec ...
/code> Do not skip files with offline attribute set. */A:attr Specifies color attribute with two hex digits. See "color /?" */F:file Reads file list from the specified file(/ stands for console). */C:string Uses specified string as a literal search string. */G:file Gets search strings from the specified file(/ stands for console). */D:dir Search a semicolon delimited list of directories Note: Following command displays the detailed help about this command: FINDSTR /?


Example

Save your running services into file _services.txt and search in this file for lines containing word "network" - case insensitive: @echo off set searchstr=network net start>_services.txt FINDSTR /I "%searchstr%" _services.txt pause output would be:
 Network Connections
 Network List Service
 Network Location Awareness
 Network Store Interface Service
 Windows Media Player Network Sharing Service
Press any key to continue . . .


See also

*
Regular expression A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or ...
*
Wildcard character In software, a wildcard character is a kind of placeholder represented by a single character, such as an asterisk (), which can be interpreted as a number of literal characters or an empty string. It is often used in file searches so the full na ...
*
List of DOS commands This article presents a list of commands used by DOS operating systems, especially as used on x86-based IBM PC compatibles (PCs). Other DOS operating systems are not part of the scope of this list. In DOS, many standard system commands were pro ...
*
find Find, FIND or Finding may refer to: Computing * find (Unix), a command on UNIX platforms * find (Windows), a command on DOS/Windows platforms Books * ''The Find'' (2010), by Kathy Page * ''The Find'' (2014), by William Hope Hodgson Film and tel ...
*
grep grep is a command-line utility for searching plain-text data sets for lines that match a regular expression. Its name comes from the ed command ''g/re/p'' (''globally search for a regular expression and print matching lines''), which has the sam ...


References


Further reading

* *


External links


findstr , Microsoft Docs
{{Windows commands Microcomputer software Windows administration Pattern matching