0

In PowerShell ISE I would like to comment out a line or multiple lines at once with a keyboard shortcut like how Sublime Text does this.

Is this possible to add or remove the # shown in the example below via a keyboard shortcut?

[console]::beep(350,400) < toggle betweeen these > #[console]::beep(350,400)

0

This AFAIK cannot be done in the native editor but it can with:

https://code.visualstudio.com/

And by installing an extension called PowerShell by using the Ctrl + Shift + X and searching for PowerShell and installing.

This will allow debugging and syntax highlighting and also has the keyboard shortcuts for blocking out comments Like so:

  • Ctrl + / for toggling a line comment

  • Ctrl + Shift + A for to toggling block comments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.