[Solved] How to search a string in multiple files and return file name with line number/text in an Excel or csv in Powershell


Try this (don’t know if you only want the filename or the path to the file, just remove the one you dont want):

Get-ChildItem -recurse | Select-String -pattern "string" | Select-Object path,line,linenumber,filename | Export-Csv -Path c:\somepath\result.csv

6

solved How to search a string in multiple files and return file name with line number/text in an Excel or csv in Powershell