Wednesday, April 01, 2015

PowerShell Tip : Comment/Uncomment Code

Many people who use plain Vanilla ISE are not familiar with this small trick which was added in PowerShell v3.

In PowerShell v3 ISE you can comment/uncomment lines of code without installing any Add-Ons :

Comment Code :

  • Press Alt + Shift + Up/Down arrow key to select lines
  • Once lines are selected, Press "#" to comment

Uncomment Code :

  • Follow the same Key shortcut to select text [Alt + Shift + Up/Down].
  • Once selected , Press Delete.

Below is a animated GIF showing this in Action :




Resources :


https://connect.microsoft.com/PowerShell/feedback/details/711231/ise-v3-need-to-be-able-to-comment-a-series-of-lines-in-a-block-of-code

http://blog.danskingdom.com/powershell-ise-multiline-comment-and-uncomment-done-right-and-other-ise-gui-must-haves/




7 comments:

  1. This trick helps a lot ! Thank your for sharing !

    ReplyDelete
    Replies
    1. Glad it helped Michael,

      Thanks for taking time to comment :)

      Delete
  2. Hey, that's cool. Thanks!

    ReplyDelete
  3. Thanks Garrett for taking time to comment.
    Appreciate it.

    ReplyDelete