2018-09-16 20:32:14 +01:00
|
|
|
# findstr
|
|
|
|
|
|
|
|
> Find specified text within one or more files.
|
2022-10-04 16:06:23 +01:00
|
|
|
> More information: <https://learn.microsoft.com/windows-server/administration/windows-commands/findstr>.
|
2018-09-16 20:32:14 +01:00
|
|
|
|
|
|
|
- Find space-separated string(s) in all files:
|
|
|
|
|
|
|
|
`findstr "{{query}}" *`
|
|
|
|
|
2019-11-09 13:37:46 +00:00
|
|
|
- Find space-separated string(s) in a piped command's output:
|
|
|
|
|
|
|
|
`{{dir}} | findstr "{{query}}"`
|
|
|
|
|
2018-09-16 20:32:14 +01:00
|
|
|
- Find space-separated string(s) in all files recur[s]ively:
|
|
|
|
|
|
|
|
`findstr /s "{{query}}" *`
|
|
|
|
|
|
|
|
- Find strings using a case-insensitive search:
|
|
|
|
|
|
|
|
`findstr /i "{{query}}" *"`
|
|
|
|
|
|
|
|
- Find strings in all files using regular expressions:
|
|
|
|
|
|
|
|
`findstr /r "{{expression}}" *`
|
|
|
|
|
|
|
|
- Find a literal string (containing spaces) in all text files:
|
|
|
|
|
|
|
|
`findstr /c:"{{query}}" *.txt`
|
|
|
|
|
|
|
|
- Display the line number before each matching line:
|
|
|
|
|
|
|
|
`findstr /n "{{query}}" *`
|
|
|
|
|
|
|
|
- Display only the filenames that contain a match:
|
|
|
|
|
|
|
|
`findstr /m "{{query}}" *`
|