看get-help get-childitem
,我会算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] []
但是,以下命令只能找到2(Items和LiteralItems):
get-command get-childitem | select-object -expand ParameterSets | select-object Name
FWIW,show-command也只通过UI中的2个标签显示2个参数集。
我想问题是为什么生成的get-childitem帮助似乎打破了最后一个用例。
答案 0 :(得分:2)
只有两个参数集。
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>]
我相信帮助中显示的第三个集合向您展示了FileSystem提供程序的动态参数。当我在Get-ChildItem上执行帮助以查看证书提供者的动态参数时,我看到了这一点,例如:
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>]