This question is there in my mind since a while. I am not able to find an answer to the same yet.
When you go through help topic for any PowerShell Cmdlet with -Full parameter, you will see ‘Accept wildcard characters? false’ under the PARAMETER details under each parameter.
So far I have not seen it as set to True in any case. Can someone please explain what it is and why it is always false, even when it was supposed to be true. For example, when you look at help for Get-Command Cmdlet, the -Name parameter accepts wildcards for searching for any Cmdlet. But, even for this parameter, it shows ‘Accept wildcard characters? false’.
Please help me understand this.
To set the switch to True, you need to use:
To implement the wildcard (globbing) switch, the cmdlet look like it needs to be written in C#. For advanced function, I’ve never seen a way to set that parameter value. I do see some folks asking for it:
I’ve done cmdlets that do wildcard searches and I just ensure the HELP and COMMENTS indicate that it supports wildcard searches, because in my SQL statement I’m simply doing a LIKE versus a = and replace * with %. A poor implementation, I’m not sure, but from an advanced function standpoint I haven’t see a better way to do it. It may be easier to just update the help and comment documentation versus doing the entire wildcard implementation just to flip the switch to true.
I’m not completely sure if I got what you mean but when I run
Get-Help Get-Command -Full
on my Windows 7 client with the PSVersion 5.0.10586.117 I get following output in the PARAMETERS section:
Specifies an array of names. This cmdlet gets only commands that have the specified name. Enter a name or name pattern. Wildcard characters are permitted.
Thank you for the inputs.
That sounds strange. I was under impression that while using with command parameters, only ‘*’ and ‘?’ are considered wildcard characters. Thus I was expecting (for example) the -Name parameter in Get-Command should be shown as True in below output:
Specifies an array of names. This cmdlet gets only commands that have the specified name. Enter a name or name pattern. Wildcard characters
To get commands that have the same name, use the All parameter. When two commands have the same name, by default, Get-Command gets the
command that runs when you type the command name.
Default value None
Accept pipeline input? True (ByValue, ByPropertyName)
Accept wildcard characters? false
There should be some way to do this using Parameter Decorator in advance functions.