Converting VBScript's Rem Statement

Definition: Includes explanatory remarks in a program.


To add a comment to a Windows PowerShell script (or a Windows PowerShell command, for that matter) simply preface that comment with the pound sign (#); anything following the pound sign will be treated as a comment and ignored by the script processor. For example, this command calls the Get-Date Cmdlet and then tacks on a comment explaining what the Cmdlet does:

get-date # This Cmdlet retrieves the current date and time

When you execute this command you’ll simply get back the current date and time; the comment will be ignored. That’s also true with this command:

get-date # get-help

The Get-Date Cmdlet will be executed; the Get-Help Cmdlet will not. That’s because, in this example, Get-Help is a comment, not a command.

Return to the VBScript to Windows PowerShell home page