PowerShell 指定フォルダ配下を再帰的に検索

指定フォルダ配下を再帰的に検索するサンプルです。


Get-ChildItem 検索フォルダ -include 検索対象の拡張子 -Recurse -Force | Select-String 検索対象の文字列 -Encoding default

使用例

Get-ChildItem . -include *.txt -Recurse -Force | Select-String “test” -Encoding default

特定の文字列を含むファイルを再帰的に検索するサンプル
Select-String “ファイル名” (dir -recurse 検索対象のパス\*.拡張子)

使用例
C:\Users\hiroyoshi\Documents\powershell配下からファイル名にtestを含むファイルを再帰的に検索する。

Select-String “test” (dir -recurse C:\Users\hiroyoshi\Documents\powershell\*.txt)

Bookmark this on Yahoo Bookmark
Bookmark this on Google Bookmarks
Share on LinkedIn
LINEで送る
Pocket