PowerTip: Use PowerShell Multiple-Line Comments

PowerTip: Use PowerShell Multiple-Line Comments

  • Comments 3
  • Likes

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

 #>

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • <p>&lt;# </p> <p>this works good, but less convenient then the</p> <p>comment/uncomment buttons in my IDE</p> <p> #&gt;</p>

  • <p>@Knuckle-Dragger of course. But it is nice to have options :-)</p>

  • <p>Use multi-line comments to insert quick help into modules, functions and scripts. &nbsp;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</p> <p>&lt;# </p> <p>#requires -version 2.0</p> <p> .SYNOPSIS</p> <p> .DESCRIPTION</p> <p> .PARAMETER &nbsp;&lt;Parameter-Name&gt;</p> <p> .EXAMPLE</p> <p> .INPUTS</p> <p> .OUTPUTS</p> <p> .NOTES</p> <p> &nbsp; &nbsp;Author: &lt;author&gt;</p> <p> &nbsp; &nbsp;Created: &lt;mm-dd-yyyy&gt;</p> <p> .LINK</p> <p>#&gt;</p>