1.

How Do You Comment Out Code In Powershell?

Answer»

Like other languages powershell ALSO supports single/Inline comments line and multi line comments.

Starting with PowerShell V1 there’s only # to MAKE the text after it a comment.

In PowerShell V2 “<# #>” can be used for BLOCK comments (multi-line) and more specifically for SYNOPSIS, DESCRIPTION, NOTES, LINK help comments.

Example: Sinlgle/Inline comments

 # This is a single or inline comment starts with hash in Powershell

Example: Block comments (multi-line)

<# this is a first line of comment

this is a second line of comment

this is a THIRD line of comment

.

.

.

this is a last line of comment

#>

Like other languages powershell also supports single/Inline comments line and multi line comments.

Starting with PowerShell V1 there’s only # to make the text after it a comment.

In PowerShell V2 “<# #>” can be used for block comments (multi-line) and more specifically for SYNOPSIS, DESCRIPTION, NOTES, LINK help comments.

Example: Sinlgle/Inline comments

 # This is a single or inline comment starts with hash in Powershell

Example: Block comments (multi-line)

<# this is a first line of comment

this is a second line of comment

this is a third line of comment

.

.

.

this is a last line of comment

#>



Discussion

No Comment Found