Automating the world one-liner at a time…
<Update 01/04/2012: This post was written in 2008, when PowerShell was in version 1. Block comments were introduced in Version 2.>
One of the raging debates that have had within the team is the issue of whether to support block comments. In PowerShell, we have the comment character # e.g.
# This is a test get-Process -Name LSASS # you can put a comment at the end of a line too
There are times when you have a large set of lines that you need to comment out (e.g. code in progress, cutting out code to test something, function headers, etc). Some believe that we should support a block comment model like C. e.g.
/* Now is the time to use PowerShell */
so you don't have to put a # in front of every line:
# Now # is # the # time # to # use # PowerShell
Now you can join the debate. The connect database has a bug filed on this that you can vote on or comment on. https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=319307&SiteID=99
Let us know what you think.
If you need help knowing what to think, let me know and I'll tell you. :-)
Jeffrey Snover [MSFT] Windows Management Partner Architect Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
In other news, debate is raging over whether or not cars should have steering wheels.
.< help keyword>
< help content>
Is there any way to achieve partially block? Entry from: http://borse-cinture-it.org/
I like to be able to comment out the whole block with /* ... */
I hate block comments and have instead written a PowerShell ISE addon that adds a keyboard shortcut for applying single-line comments to multiple lines. Check it out at blog.danskingdom.com/powershell-ise-multiline-comment-and-uncomment-done-right-and-other-ise-gui-must-haves