Get-Alias ?

If you want to find the cmdlet "behind" the alias ?, command Get-Alias ? won't help you, because ? will be treated as a wildcard for a single character, and you will get all single-character aliases:

PS>get-alias ?

CommandType Name Definition
----------- -        ---       ----------
Alias                 %        ForEach-Object
Alias                 ?        Where-Object
Alias                 h       Get-History
Alias                 r        Invoke-History

To use ? as the literal value, you have to escape it with a backtick and put it in single quotes:

PS>get-alias '`?'

CommandType Name Definition
-----------           ----    ----------
Alias                  ?       Where-Object

Double quotes don't work in both V1 and V2 CTP3. Does somebody know why?


Posted Feb 17 2009, 01:28 PM by Aleksandar
Filed under: ,

Comments

Aleksandar wrote re: Get-Alias ?
on 02-17-2009 10:45 AM

I've just found out that if you want to use double quotes, you have to escape it twice:

PS>Get-Alias "``?"

Is that a bug?

Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.