1
votes

Looking at get-help get-childitem, I would count 3

SYNTAX Get-ChildItem [[-Path] ] [[-Filter] ] [-Exclude ] [-Force] [-Include ] [-Name] [-Recurse] [-UseTransaction []] []
Get-ChildItem [[-Filter] ] [-Exclude ] [-Force] [-Include ] [-Name] [-Recurse] -LiteralPath [-UseTransaction []] []
Get-ChildItem [-Attributes ] [-Directory] [-File] [-Force] [-Hidden] [-ReadOnly] [-System] [-UseTransaction] []

The following command, though, only finds 2 (Items and LiteralItems):

get-command get-childitem | select-object -expand ParameterSets | select-object Name

FWIW, show-command also only shows 2 parameter sets via 2 tabs in the UI.

I guess the question is why the generated help for get-childitem seems to break out the last use-case.

1

1 Answers

2
votes

There are only two parameter sets.

PS> gcm Get-ChildItem -syntax

Get-ChildItem [[-Path] <string[]>] [[-Filter] <string>] [-Include <string[]>] [-Exclude <string[]>] [-Recurse]
[-Force] [-Name] [-UseTransaction] [-Attributes <FlagsExpression[FileAttributes]>] [-Directory] [-File] [-Hidden]
[-ReadOnly] [-System] [<CommonParameters>]

Get-ChildItem [[-Filter] <string>] -LiteralPath <string[]> [-Include <string[]>] [-Exclude <string[]>] [-Recurse]
[-Force] [-Name] [-UseTransaction] [-Attributes <FlagsExpression[FileAttributes]>] [-Directory] [-File] [-Hidden]
[-ReadOnly] [-System] [<CommonParameters>]

I believe that third set that is shown in help is showing you the dynamic parameters for the FileSystem provider. That jives with what I see when I execute the help on Get-ChildItem to see the dynamic parameters for the Certificate provider e.g.:

PS> Get-Help Get-ChildItem -Full -Path cert:\

SYNTAX
    Get-ChildItem [[-Path] <String[]>] [[-Filter] <String>] [-Exclude <String[]>] [-Force] [-Include <String[]>]
    [-Name] [-Recurse] [-UseTransaction [<SwitchParameter>]] [<CommonParameters>]

    Get-ChildItem [[-Filter] <String>] [-Exclude <String[]>] [-Force] [-Include <String[]>] [-Name] [-Recurse]
    -LiteralPath <String[]> [-UseTransaction [<SwitchParameter>]] [<CommonParameters>]

    Get-ChildItem [-CodeSigningCert] [-DnsName <string>] [-EKU <string>] [-ExpiringInDays <int>]
    [-SSLServerAuthentication] [<CommonParameters>]