How do you comment out code in PowerShell (1.0 or 2.0)?
相关问题
- How to Debug/Register a Permanent WMI Event Which
- What does an “empty line with semicolon” mean in C
- How can I do variable substitution in a here-strin
- How to use a default value with parameter sets in
- Does powershell have a method_missing()?
相关文章
- 在vscode如何用code runner打开独立的控制台窗口,以及设置好调试模式时窗口的编码?
- C#调用PowerShell的问题
- EscapeDataString having differing behaviour betwee
- What is the meaning of this syntax?
- PowerShell Change owner of files and folders
- How can I write-protect the Matlab language?
- Why the enum constants must be declared before any
- Command line escaping single quote for PowerShell
Here
You can make:
You use the hash mark like this
Wikipedia has a good page for keeping track of how to do comments in several popular languages
http://en.wikipedia.org/wiki/Comparison_of_programming_languages_(syntax)#Comments
It's the
#
.See PowerShell - Special Characters And Tokens for special characters.
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.Single line comments start with a hash symbol, everything to the right of the
#
will be ignored:In PowerShell 2.0 and above multi-line block comments can be used:
You could use block comments to embed comment text within a command:
Note: Because PowerShell supports Tab Completion you need to be careful about copying and pasting
Space + TAB
before comments.