Save the results of a Grep on Windows to a text file | WindowsでGrepした結果をテキストファイルに保存する

Penguins at Asahiyama Zoo ask where the file was hidden 旭山動物園のペンギン
get-childitem c:\Users\* -include *.* -recurse |
select-string -pattern "SearchString" -casesensitive > c:\Users\YourName\Desktop\findResult.txt

Username YourName

File Desktop\findResult.txt

As in DOS, it will create a file with the name you specify to the right of the “>” mark and overwrite it with the new GREP result.

  • Please note that the example shops Grep all files up to subdirectories.