Comment-Based Help

noun

say it: “KOM-ent BAYST HELP” /ˈkɑmɛnt ˈbeɪst ˈhɛlp/

A help page written in a comment block at the top of a PowerShell function, which Get-Help shows like a built-in command's help.

What is comment-based help?

Comment-based help is a help page you write inside your function, in a <# #> block at its top. Each keyword starts a part: .SYNOPSIS for one line, .DESCRIPTION, .PARAMETER for each parameter and .EXAMPLE. Get-Help shows it like a built-in command's help.

function Add-Song {
    <#
    .SYNOPSIS
    Adds a song to the road-trip playlist.
    .EXAMPLE
    Add-Song -Title 'Toll Booth Blues' -Minutes 4 -Mood Upbeat
    #>
}

In a sentence

  • “Get-Help Add-Song -Examples showed Sam's comment-based help.”
  • “Sam wrote comment-based help with a synopsis and two examples.”

Level: Journeyman · More PowerShell terms at this level

Updated