Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiline comment in PowerShell

People also ask

How do I comment out a line in PowerShell?

Syntax Description You can type a comment symbol ( # ) before each line of comments, or you can use the <# and #> symbols to create a comment block. All the lines within the comment block are interpreted as comments. Each section of comment-based Help is defined by a keyword and each keyword is preceded by a dot ( . ).

How do I comment a whole section in PowerShell?

In PowerShell to comment, # is used. Everything that follows # in the same line is considered a comment by the PowerShell interpreter. This is used for single-line commenting, for multi-line commenting, or a comment block <#…. #> is used.

How do you comment out a block of code in PowerShell?

We use the symbol ( # ) to comment out the code. We call this symbol by many names like the number sign or the hash, but Microsoft officially called this the comment symbol. A single comment symbol ( # ) will comment out the code from the first # up until the end of the line.


In PowerShell v2 and newer, use the following syntax for the multiline comments:

<# a
   b
   c #>

The multiline comment in PowerShell should work.

If not, try this...

# This is
# a
# multiline comment.

or

<#
This does works for me.
#>

If it doesn't work, try to check if you have the correct version of PowerShell.