Thursday, 27 May 2010

Multiline Comments in Powershell

It's hard to believe but you can't do multiline comments in Powershell for some reason! Shame on you Microsoft! Here is a bit of a hack to allow you to right comments over multiple lines using a multiline string declaration:

@'
This is a hack so
you can do a multiline
comment in powershell
'@ > $null

Points to note...

  • The closing '@ has to be in column 0
  • No whitespace allowed after the opening @'
  • Redirect the output (or cast to [void]) unless you want to see it on the console or in a log file

3 comments:

  1. Hey! thanks for useful review. It was easy to read, but I'd like to add that if your business needs to be updated try software development services.

    ReplyDelete
  2. Thank you for mentioning this. Many poker affiliates look for fresh lastest best casino affiliate programs at such comparison online gambling websites.

    ReplyDelete
  3. That is nice info. Let me mention about home insurance that are from house insurance providers. Compare online quotes on homeowners insurance.

    ReplyDelete