Write-Host with formated number called from cmd

by May 19, 2013

Hi all,

I'm new in PowerShell and I try to display formated number from cmd.

Into PowerShell the following command works fine:

PS E:> Write-Host ("{0:N0}" -f 123456789 )
123 456 789

but when I try the following from cmd, it doesn't work:

E:>PowerShell -Command "&{Write-Host (("{0:N0}" -f 123456789 ))}"
0:N0

 

Thank you for your help.

Olivier.