Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Format Decimal Numbers in PowerShell

$
0
0

Summary: Learn how to display a specific number of decimal points in Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to display only one decimal place on a number that currently has two?

Hey, Scripting Guy! Answer Use a custom number format string with the ToString method from the number, for example:

PS C:\> (1.11).tostring("#.#")

1.1


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>