-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
Summary of the new feature / enhancement
I was trying to use the built-in help system to learn how to search for text in output, like grep on Unix. So, I tried this command:
Get-Help *find*
Name Category Module Synopsis
---- -------- ------ --------
Find-PSResource Cmdlet Microsoft.PowerShell.PSR… Find-PSResource…
Find-PackageProvider Cmdlet PackageManagement Find-PackageProvider…
Find-Package Cmdlet PackageManagement Find-Package…
Find-Script Function PowerShellGet …
Find-Command Function PowerShellGet …
Find-RoleCapability Function PowerShellGet …
Find-Module Function PowerShellGet …
Find-DSCResource Function PowerShellGet …
Find-LapsADExtendedRights Cmdlet LAPS Find-LapsADExtendedRights…
Find-NetIPsecRule Function NetSecurity …
Find-NetRoute Function NetTCPIP …As you can see, this brought up several commands that had "find" in their name, but none of them were what I needed. I asked ChatGPT and it said "Select-String." I looked at the help page for Select-String:
Get-Help Select-String
NAME
Select-String
SYNOPSIS
Finds text in strings and files.
...Hmm...
Get-Help "finds text"
Name Category Module Synopsis
---- -------- ------ --------
Select-String Cmdlet Microsoft.PowerShell.Uti… Finds text in strings and files.
Select-Xml Cmdlet Microsoft.PowerShell.Uti… Finds text in an XML string or document.There it is!
When you are using the help system to try to find a command, you don't know what that command is called. In my case, I thought it might contain "find" in the name or description. Had Get-Help done a full-text search, I would have found the command I needed with this query. Instead, the command was hidden from me because a bunch of commands I didn't need had "find" in the name. As someone new to PowerShell, I could not easily guess what a good query string would be to avoid this situation, because I know nothing about the commands! That's why I'm using Get-Help in the first place!
The moral of this story is that there should be a way to force Get-Help to do a full-text search regardless of whether the pattern matches any command names. However, from reading the help page for Get-Help, it looks like the only way to get it to do a full-text search is to give it a search term that doesn't match the name of any command.
Proposed technical implementation details (optional)
No response