How to Comment a block of lines in Powershell ISE

Unfortunately you can’t quickly comment a block of code in Powershell ISE like you can do in VisualStudio, but since Powershell 3.0, pressing and holding ALT, the mouse selection will be not by line but by box.
This means you can use a trick to comment or uncomment a block of lines:
Pressing ALT key + LEFT mouse button, drag the mouse down, selecting with a tiny blue line the lines you what to comment (on image lines 34-36); then press # to comment.

PwrshellISE_ALTSelect

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s