Export (0) Print
Expand All
Expand Minimize

Converting VBScript's Rem Statement


Windows PowerShell


Definition: Includes explanatory remarks in a program.

Rem

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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft