Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to round numbers. Hey, Scripting Guy! I think your series about formatting numbers has been pretty interesting. However, everything you have shown has a major problem—and that is that you convert numbers into strings. I would love to be able to d
Summary: Learn an easy method to express a percentage in Windows PowerShell. How can I use Windows PowerShell to express a two-decimal place percentage? For example, I have multiple calculations in a Windows PowerShell script, and I am tired of always dividing two numbers, multiplying
Summary: Microsoft Scripting Guy, Ed Wilson, talks about using standard number formats. Hey, Scripting Guy! I love using Windows PowerShell. I use it for everything. My problem is that it does not do everything automatically. For example, I use the Get-Volume cmdlet a lot to check on disk space, but I need to do a manual calculation to s
Summary: Use Windows PowerShell to round numbers to a specific decimal place. 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. Use the Round static method from the System.M
Summary: Learn how to display a specific number of decimal points in Windows PowerShell. How can I use Windows PowerShell to display only one decimal place on a number that currently has two? Use a custom number format string with the ToString method from the number, for example: PS C:\> (1.11).tostring("#.#"