On Linux, I often use grep with context to find usage information in man pages. Something like
man ls | grep -e '-a' -A 5
will give me enough context to know what the -a option does.
I think Select-String can do something similar, but I can’t seem to pipe in the content of Get-Help, just a Get-Help object. I’d like to do something like
Get-Help Get-ChildItem -Detailed | Select-String -Pattern "-Name" -Context 5
to get information about the -Name usage, but this doesn’t seem to work.
What’s a good way to do this?
As @Lee said, if you want just the help for a parameter, use
Get-Help‘s-Parameterargument. Otherwise, you can useSelect-Stringif you convert the output ofGet-Helpto an array of strings withOut-String -Stream.