Monday, 31 October 2011

Show-StandardNFS-1.ps1

  1. <# 
  2. .SYNOPSIS 
  3.     This script shows the first two samples on this MSDN Page, 
  4.     convered to PowerShell  
  5. .DESCRIPTION 
  6.     This script displays two lines of text using PowerShell 
  7.     and .NET formatting information 
  8. .NOTES 
  9.     File Name  : Show-StandardNFS-1.ps1 
  10.     Author     : Thomas Lee - tfl@psp.co.uk 
  11.     Requires   : PowerShell Version 2.0 
  12. .LINK 
  13.     This script posted to: 
  14.         http://www.pshscripts.blogspot.com 
  15.     MSDN sample posted tot: 
  16.         http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx 
  17. .EXAMPLE 
  18.     [Cookham8:C:\foo]> .\Show-StandardNFS.ps1 
  19.     $123.46 
  20.     Your account balance is $123.46. 
  21. #> 
  22.  
  23. # Show formatting a number as currency 
  24. $value = 123.456 
  25. $value.ToString("C2"
  26.  
  27. # Show the -f operator with currency formatting 
  28. $value = 123.456 
  29. "Your account balance is {0:C2}." -f $value 

No comments: