Was this page helpful?
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Converting VBScript's FormatCurrency Function

Windows PowerShell

Definition: Returns an expression formatted as a currency value using the currency symbol defined in the system Control Panel.


To format a Windows PowerShell value as currency you simply use the .NET Framework formatting commands. The following two commands assign the value 1000 to the variable $a, then use the currency formatting string “{0:C}” to format the value as currency (note that the value to be formatted is included as part of the -f parameter):

$a = 1000
$a = "{0:C}" -f $a

When you run this command and then echo back the value of $a you should get the following:


Return to the VBScript to Windows PowerShell home page

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