Last active
July 19, 2020 04:35
-
-
Save willwm/4eee9f93e223229a60268808b4da4acc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://win32.io/posts/How-To-Find-Text-PowerShell | |
Get-ChildItem "C:\path\to\folder" -recurse | Where-Object { (Get-Content $_) -like '*TextToFind*' } | Select-Object { $_.FullName } | |
# ...as a function: | |
function Find-TextInFiles($searchPath, $text) { | |
Get-ChildItem $searchPath -recurse | Where-Object { (Get-Content $_) -like '*$text*' } | Select-Object { $_.FullName } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment