How to use PowerShell Multiple-Line Comments

How to use PowerShell Multiple-Line Comments?

Use Windows PowerShell multiple line comments in your script or from the console. It is good for debugging for later using it multiple times reuse in other scripts.


Begin the comment with the <# tag, and end the comment with the #> tag:

<# this is a comment on several different lines #>


When we enter # on each line or the “#” and “#>” to surround each code block in a remark block

Now PowerShell Studio 2014 makes comments easier.

  1. To individually comment out each line (#)
  2. select one or more lines and press Ctrl + Q
  3. click Comment (in the Edit section of the Home tab).

Leave a Reply

Your email address will not be published.