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 ( . ).
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With