PowerTip: Use PowerShell Multiple-Line Comments


Summary: Use Windows PowerShell multiple-line comments in your script or from the console.

Hey, Scripting Guy! Question How do you type a multiple-line comment?

Hey, Scripting Guy! Answer Begin the comment with the <# tag, and end the comment with the #> tag:

<#

 this is a comment

            on several

            different

            lines

 #>

Comments (5)

  1. <#

    this works good, but less convenient then the

    comment/uncomment buttons in my IDE

    #>

  2. jrv says:

    Use multi-line comments to insert quick help into modules, functions and scripts.  Teh follwoing can be autoinserted when a new fie is creted or it can be inserted via the menu in your fovorite ISE or IDE

    <#

    #requires -version 2.0

    .SYNOPSIS

    .DESCRIPTION

    .PARAMETER  <Parameter-Name>

    .EXAMPLE

    .INPUTS

    .OUTPUTS

    .NOTES

       Author: <author>

       Created: <mm-dd-yyyy>

    .LINK

    #>

  3. Ed Wilson says:

    @Knuckle-Dragger of course. But it is nice to have options 🙂

  4. o says:

    this works good, but less convenient then the

    comment/uncomment buttons in my IDE <#
    http://dragseo.blogspot.com/2014/09/anizanalternatif-googleadsense.html

  5. Thank you very much for sharing this post! I think this is the best way to use PowerShell multiple line comments. I tried this method and I am very much satisfied with this method. Keep sharing such posts!

Skip to main content