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

PowerTip: Round Number Up or Down with PowerShell

$
0
0

Summary: Easily use Windows PowerShell to round a number up or down.  

Hey, Scripting Guy! Question I want only a whole number returned, so I want the number rounded up or down as appropriate.
           How can I do this with Windows PowerShell?

Hey, Scripting Guy! Answer Cast the number as an integer, and Windows PowerShell will round the number up or down
           as appropriate, for example:

PS C:\> [int]22.4

22

PS C:\> [int]22.5

22

PS C:\> [int]22.6

23


Viewing all articles
Browse latest Browse all 3333

Trending Articles