How to Comment Out Code in PowerShell Script

Just like any other programming language, you can comment out code in a PowerShell script for documentation purposes.

To comment out a single line, put '#' in the beginning:

Single line comment

To comment out multiple lines, put <# at the beginning and #> at the end of code.

Multi line comment in PowerShell


Leave a Comment