How can we add multiline comment in powershell script?
$a=10 $b=20
writ-host "Sum"
How can we add multiline comment in powershell script?
$a=10 $b=20
writ-host "Sum"
We can add multiline comment in powershell as below
<#
$a=10
$b=20
writ-host "Sum"
#>
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...
#>
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