Summary: Use Windows PowerShell to create a function list and find files.
How can I use Windows PowerShell to avoid repetitively typing “ls . –r *.ps1” to get a list of PowerShell files and then
“ls . –r *.ps1 | sls function” to search the content of those files for a string?
Add this function to your PowerShell profile:
function fps ($find) {
"Get-ChildItem . -Recurse *.ps1 $(if($find) { "| Select-String $find" })" |
Invoke-Expression
}
Then, if you type `fps`, you’ll get a list of .ps1 files. To search for the string functions in each file, type `fps function`.
0 comments