Why does PowerShell help show incorrect or confusing parameter syntax?

0
0
Asked By MistyCedar42 On

I'm working through the fourth edition of PowerShell in a Month of Lunches and am currently learning about the help system. The syntax sections in some help documents are confusing because they don't seem to match how the commands actually work. For example, Get-Help Get-Item doesn't show the required -Path parameter, while Get-Help Get-ChildItem appears to list -Filter before -Path even though their positional behavior suggests the opposite. It looks as if the parameters might be sorted alphabetically, which seems especially misleading when positional parameters are involved. Is this a change in PowerShell, a problem with the help files, or am I misunderstanding how the syntax display works?

1 Answer

Answered By CopperLark19 On

Some of the locally installed help for built-in commands is genuinely inaccurate because of issues in the documentation-generation tooling. If you recently ran Update-Help, you may have downloaded affected content. The online help is generally more accurate, so you can try Get-Help -Name Get-Item -Online or Get-Help -Name Get-ChildItem -Online. Another reliable option is Get-Command -Name Get-ChildItem -Syntax, since that syntax is generated directly from the command metadata. You can also provide -ArgumentList when you want to see syntax in the context of a particular provider, such as the Registry provider.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.