Skip to content

Instantly share code, notes, and snippets.

@chrisRedwine
Last active June 17, 2024 23:21
Show Gist options
  • Save chrisRedwine/dc4d2f7ee835de07d1cd97fbb1e99147 to your computer and use it in GitHub Desktop.
Save chrisRedwine/dc4d2f7ee835de07d1cd97fbb1e99147 to your computer and use it in GitHub Desktop.
Windows command to recursively search for a string in a directory and output results to txt file (s = recursive, i = case insensitive, n = line number detail)
findstr /sin “searchstring” *.* > output.txt
@septer012
Copy link

septer012 commented Oct 5, 2023

Thanks for this. This is the second result on google when I search "findstr recursive". I suggest you make an edit for those of us living in corporate world under the microsoft onedrive cloud where files are pulled from the computer to the cloud. Adding /OFFLINE forces the files in the directory to be downloaded locally before the search is done.

FINDSTR: Files with offline attribute were skipped.
Use /OFFLINE for not skipping such files.

findstr /OFFLINE /sin “searchstring” *.* > output.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment