PowerTip: Find All Defined One-Letter PowerShell Aliases

PowerTip: Find All Defined One-Letter PowerShell Aliases

  • Comments 3
  • Likes

Summary: Learn how to find all the one-letter Windows PowerShell aliases.

Hey, Scripting Guy! Question How can I find all the defined Windows PowerShell aliases that are exactly one letter in length?

Hey, Scripting Guy! Answer Use the Get-Alias cmdlet and choose a one-letter wildcard pattern:

Get-Alias ?

 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • For sure you know it already, but you can use square to limit the search range to '?' only:

    get-alias [?]

    CommandType     Name                                                Definition

    -----------     ----                                                ----------

    Alias           ?                                                   Where-Object

    Carlo

  • @Happysysadm you are correct. This is because the ? is a wild card character, and you need to tell PowerShell to find the literal character. The following also works:

    PS C:\> gal '`?'

    CommandType     Name

    -----------     ----

    Alias           ? -> Where-Object

  • I have a question that seems related to this, but is a little more in-depth.  I am trying to convert a string of characters.  Each character needs to be the next character in the character map.  For instance, A gets converted to B, 1 gets converted to 2 and ` (that's the tick mark to the left of the "1" key) gets converted to _.  Specifically, I need:

    AbCd12` would get converted to BcDe23_

    Anyone have an idea of how to accomplish this?