PowerShell: Multiline Comments


Comments play an important role in writing readable code and maintaining the working software. In PowerShell, comments begin with a Hash (#) sign. # can be included anywhere but inside a string to make the rest of the line a comment.

# This a comment. Single line comment.
Get-Service -Name BITS

How to add multi-line comments in PowerShell? Powershell has come a long way since the public release of PowerShell version 1 in 2006. From version 2 onwards PowerShell supports multiline comments. PowerShell multiline comments begin with '<#' and ends with '#>'

<#
This is also commented. 
Multi-line comment.
#>
Get-Process -Name explorer

Comments

Popular posts from this blog

Check SQL Server Database Status

PowerShell and Azure Resource Graph

Mutual TLS (MTLS) for Securing REST API Endpoints Behind an Application Gateway Executive Summary