Can we comment multiple lines together in PowerShell?

I tried looking, but I didn't find any answer. It's quite irritating to comment each line manually if the script is too long.

1

2 Answers

In PowerShell v2 and newer, use the following syntax for the multiline comments:

<# a b c #> 
1

The multiline comment in PowerShell should work.

If not, try this...

# This is # a # multiline comment. 

or

<# This does works for me. #> 

If it doesn't work, try to check if you have the correct version of PowerShell.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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