Using Block Comment in the ISE Editor

by Jan 8, 2014

There is a little known trick that you can use to block-prepend or block-remove characters in the ISE editor. This feature was introduced in PowerShell 3.0.

In the ISE editor, click to where you would like to enter something (like the start of a block comment). Next, hold SHIFT+ALT, then press ARROWDOWN to move the caret downwards.

A tiny green line appears inside the ISE editor. Once you marked the block, and while the green line is still visible, enter "#" (or whatever else you want to preprend to all of the marked lines). Likewise, you can now blockwise delete characters as well.

Twitter This Tip! ReTweet this Tip!