I have started learning powershell a couple of days ago, and I couldn\'t find anything on google that does what I need so please bear with my question.
I have been a
If you search into one directory, you can do it:
select-string -Path "c:\temp\*.*" -Pattern "result" -List | select Path
This will display a list of the full path to each file that contains the search string:
foreach ($file in Get-ChildItem | Select-String -pattern "dummy" | Select-Object -Unique path) {$file.path}
Note that it doesn't display a header above the results and doesn't display the lines of text containing the search string. All it tells you is where you can find the files that contain the string.
Get-ChildItem -r | ? {$_.psiscontainer -eq $false} | ? {gc $_.pspath |select-string -pattern "dummy"}
This will give you the full details of all files
With PowerShell, go to the path where your files are and then type this command and replace ENTER THE STRING YOU SEARCH HERE
(but keep the double quotes):
findstr /S /I /M /C:"ENTER THE STRING YOU SEARCH HERE" *.*
Have a nice day
This is how I would do it, you don't need get-content:
ls -r | Select-String dummy | select line,path
or
ls -r | Select-String dummy | fl *
To see what the different properties are...
This is faster. The second argument is -filter:
ls -r . *.bat | select-string netsh
ls -r . -filter *.bat | select-string netsh