Same like other programming language, the comments in Powershell will not executed. Comments can be added to explain the function of the code and it can ย be placed anywhere and anything between them will be treated as a comment.ย The powershell also supports single line and multi line comments.
Single Line Comments
SYNTAX: #
The comment with the # will handling single line comments.ย In PowerShell single line comments start with a hash symbol and everything to the right of the # will be ignored.
1 |
$MyFirstVaiable = "Hello" #Example for single line comments. |
Multi-lineย Comments
Begin the comment with the <# tag, and end the comment with the #> tag for handling multiline.ย Multi-line comments are typically used to add descriptive help at the start of a script.
SYNTAX: <# #>
1 2 |
$MyFirstVaiable = "Hello" <# Example for Multiple line comments. This variable use to display hello #> |
Leave A Comment