findstr review: Handy Windows tool for command searches for text strings
findstr is a built-in tool of the Windows operating system that you may run from the command line to find text in files or in command-line outputs. In other words, if you want to find specific exact match text strings in files, in a command-line output, or elsewhere, you may use the free findstr command on Windows to do so. It is available in all major Windows versions including Windows 10.
You can use the application to filter command-line outputs and search individual files or entire directory structures for files with matching text.
What is findstr – Search for Text in Windows Files
findstr is a powerful command that you may use to search for strings in files or to filter command line output. You may use it to scan entire directory structures or drives for files that match the selected string or part of it, and to find specific text in command line outputs quickly.
You can run findstr from the command line or as a batch file. Open a new command line prompt by clicking on the Windows-key, typing cmd.exe, and selecting the result. Alternatively, use the Run command to open findstr.
Some Useful Parameters in findstr
As you explore findstr, the following parameters will help you find specific texts. For example, you can look for exact match or case-sensitive words inside files.
- /? -- display the help text
- /S -- searches the directory and all subdirectories
- /I -- search is not case sensitive
- /R -- use search strings as regular expressions
- /B -- matches patterns at the beginning of lines
- /P -- skip files with non-printable characters
- /V -- print only lines that contain a match
- /N -- print the line number
findstr Examples That You May Find Useful
Consider these examples to try with findstr:
- ipconfig | findstr "192.168" -- The command runs ipconfig and returns any result that matches 192.168. Any other result is ignored.
- netstat | findstr "22.214.171.124" -- Runs the netstat command and returns any result that matches the string (in this case the IP address).
- findstr /c:"windows 10" windows.txt -- Searches the document windows.txt for the string "windows 10"
- findstr "windows 10" windows txt -- Searches for "windows" or "10" in the file.
- findstr "windows" c:\documents\*.* -- Searches any file under c:\documents for the string "windows".
- findstr /s /i Windows *.* -- Searches every file in the current directory and all subdirectories for the word Windows ignoring letter case.
- findstr /b /n /r /c:"^ *FOR" *.bas-- Returns any line that begins with FOR that are preceded by zero or more spaces. Prints the line number as well.
Advanced options include returning content that is found at the beginning or end of lines, using regular expressions, or using wildcards.
findstr's main advantage is that it is a built-in tool that you can run on any Windows machine. It is useful to find text in files quickly but works as a tool to filter the output of command-line tools as well. It’s free, quick, and easy to use – what more do you need from a search tool?
Now you: Which program do you use to find text in files?Advertisement