0

How can we add multiline comment in powershell script?

$a=10 $b=20

writ-host "Sum"

0

3 Answers 3

0

We can add multiline comment in powershell as below

<#

$a=10

$b=20

writ-host "Sum"

#>

Sign up to request clarification or add additional context in comments.

Comments

0

Yes, PowerShell supports multi-line block comments:

<#
$a=10
$b=20

Write-Host "Sum"
#>

Do note that block comments are non-nestable:

<# 
This is part of the comment
<#
$a=10
$b=20

Write-Host "Sum"
#>
But this is not...
#>

Comments

0

You can use the <# and #> symbols to create a comment block.

<#
    $a=10
    $b=20

    writ-host "Sum"
#>

Documentation: https://learn.microsoft.com/en-us/powershell/scripting/developer/help/syntax-of-comment-based-help?view=powershell-7.1

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.