How do you comment out code in PowerShell (1.0 or 2.0)?
Powershell – How to comment out code in PowerShell
commentspowershellpowershell-2.0syntax
Related Question
- What’s a quick way to comment/uncomment lines in Vim
- Powershell – Determine installed PowerShell version
- How to do block comments in YAML
- Xml – How to comment out a block of tags in XML
- PowerShell says “execution of scripts is disabled on this system.”
- Comments in Markdown
- How to “comment-out” (add comment) in a batch/cmd
- Java – Why is executing Java code in comments with certain Unicode characters allowed
Best Solution
In PowerShell V1 there's only
#
to make the text after it a comment.In PowerShell V2
<# #>
can be used for block comments and more specifically for help comments.For more explanation about
.SYNOPSIS
and.*
see about_Comment_Based_Help.Remark: These function comments are used by the
Get-Help
CmdLet and can be put before the keywordFunction
, or inside the{}
before or after the code itself.