This topic contains 3 replies, has 3 voices, and was last updated by
September 26, 2016 at 9:24 am #54600ParticipantPoints: 1Rank: Member
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.
September 26, 2016 at 12:58 pm #54603ParticipantPoints: 638Rank: Major Contributor
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.
September 27, 2016 at 5:27 am #54634ParticipantPoints: 1Rank: Member
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:
-Name  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. 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. Required? false Position? 1 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.
September 26, 2016 at 1:34 pm #54606ParticipantPoints: 1,164Rank: Community Hero
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:
-Name  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.
The topic ‘Why 'Accept wildcard characters' is always false for every parameter’ is closed to new replies.