Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

PowerTip: Round a Number with PowerShell

Summary: Use Windows PowerShell to round numbers to a specific decimal place. (image)  How can I use Windows PowerShell to round a number to a specific number of decimal places, and continue to            have a number instead of converting it to a string. (image)  Use the Round static method ...

PowerTip: Format Decimal Numbers in PowerShell

Summary: Learn how to display a specific number of decimal points in Windows PowerShell. (image)  How can I use Windows PowerShell to display only one decimal place on a number that currently has two? (image)  Use a custom number format string with the ToString method from the number, for example: PS C:\> (1.11).tostring...

Formatting PowerShell Decimal Places

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using strings to format the display of decimal places in Windows PowerShell. (image)  Hey, Scripting Guy! One of the things I have a problem with is when I get numbers that have a lot of decimal places. I mean, how do I really get rid of them—at least properly? I have done ...