Search for a string in many files from a command line

Many times I needed to search for a specific string (e.g my name) in my computer or in a specific directory from a command line, basically I need to get the same result of the grep command on linux.

Findstr is a command-line tool which searches for patterns of text in files using also regular expressions, the following example search the string "Vittorio" in all the files of a C: partition.

findstr /s /M "Vittorio" C:\*.*

For more details about this powerfull tool, take a look here on Microsoft Site.
Share on Google Plus

About Vittorio Pavesi

    Blogger Comment
    Facebook Comment

1 comments:

Anonymous said...

To count the word occurences in many files, just run
FINDSTR /C:"%keyword%" "%path%\*.log" > C:\result.txt

Then open result.txt with notepad and count the rows.