PowerTip: Find single-name PowerShell functions


Summary: Learn how to find Windows PowerShell functions that do not have a hyphen in the name.

Hey, Scripting Guy! Question How can I easily find Windows PowerShell functions that do not have a hyphen in the name, but instead are single words, such as the Prompt function?

Hey, Scripting Guy! Answer Use the Get-Command cmdlet and return only functions. Filter out function names that do not contain a hyphen, for example:

gcm -CommandType function | where name -notmatch '-'

Note gcm is an alias for the Get-Command cmdlet.

Comments (0)

Skip to main content