header image

PowerShell comments

Posted by: | September 29, 2017 Comments Off on PowerShell comments |

Putting comments into your code has been a long established practice – this is how you do PowerShell comments

A single line comment is indicated by the # symbol

# This is a comment


You can put a comment at the end of a line but not in the middle. Once you’ve added a comment that’s it for the rest of the line

Get-Process    # This is a comment

In ISE and Visual Studio Code comments are shown in green by default


You can also create multi-line comments

This is
a multi-line


Be careful if you use # symbols in file names or other data in PowerShell – you may end up with PowerShell thinking you’ve declared a comment

under: PowerShell

Comments are closed.