Search inside files from the command line with findstr
Use the built-in findstr tool to find text inside files, including all subfolders, with case-insensitive matching and line numbers.
01Command
$ findstr /s /i /n "TODO" *.txt02What it does
findstr is the Windows built-in text-search tool. /s makes it search the current folder and all subfolders, /i ignores letter case, and /n prints the line number of each hit. Wrap multi-word phrases in /c:"two words" so they're treated as one literal string instead of separate words.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Findstr - Search for patterns in filesEvidence: Documents /s (search subdirectories), /i (case-insensitive), /n (print line numbers) and /c for literal strings in findstr.
- findstr (Windows Commands)Evidence: Official findstr reference listing /s, /i, /n, /v and /c switches for searching files and subdirectories, case-insensitively and with line numbers.
Last verified: 2026-09-19 · Category: Files & Folders
06Related solutions
Search inside text files and logs with regex, returning file, line number and match.
One command that shows OS version, install date, boot time, memory, network adapters and installed hotfixes.
Built-in Windows command to compute MD5, SHA1 or SHA-256 hashes of any file.