Author Posts

January 5, 2016 at 6:41 am

I know that it is possible but i do not remember the keyboard shortcut in ISE to highlight an area of code and create a comment block or Comment out all the lines.

Any help for my failing memory would be helpful

Get-BLAhBlah
Search-BlahBLah

the desired result is being edited out. Simply I am seeking the keyboard shortcut to comment out multiple lines

January 5, 2016 at 6:46 am

I don't believe there is a "comment block of code" function in the ISE by default. However, there is a "block select" functionality in the ISE which allows you to type on multiple lines at once. To do that, put your cursor at the start of the first line. Then, while holding Alt + Shift, use your down arrow to move the cursor down to the last line you want to comment. (You're actually block-selecting multiple lines, zero columns). Then just type "# " to inject the hash and space at the beginning of those lines.

If you wanted to get rid of those comments, you can use Alt+Shift while selecting all of the "# " characters on each commented line, and then you get rid of them all with one press of Backspace or Delete.

January 5, 2016 at 8:28 am

If you have the ISESteroids module loaded, it provides Ctrl+Shift+B as a keyboard shortcut for toggling block comments. However a bug in PowerShell 5.0 prior to build 10586 prevents it from working (atleast on Windows 10).

January 8, 2016 at 4:52 am

Thank you both. I had seen it used on a you tube presentation that I had watched and they said that Steroids was not needed. @dave Wyatt that will serve the purpose that I am looking for.

I appreciate both of you for your feedback.