Tagged: Keyboard Shortcuts
- January 5, 2016 at 6:41 am #33484
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
the desired result is being edited out. Simply I am seeking the keyboard shortcut to comment out multiple linesJanuary 5, 2016 at 6:46 am #33485
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 #33497
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 #33653
You must be logged in to reply to this topic.