X

How to Comment Out Code in PowerShell Script

This guide gives you an overview of code commenting options in PowerShell. Just like any other programming language, you can comment out code in a PowerShell script for documentation purposes.

Single-line comments in PowerShell

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

Multiline Comments in PowerShell

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

 

Karim Buzdar: About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various websites.
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings