Number manipulation and parsing

PowerShell is a powerful mathematics calculator. In fact, PowerShell has an entire Windows class dedicated to mathematics calculations that can be called by using the [System.Math] .NET class. When you are working with the [System.Math] classes, it is common to call static fields within a class. Static fields are static properties, methods, and objects that can be called to display data or do actions. To call a static field, you call the [Math] (shortened version of [System.Math]) class, followed by two colons :: and the static field name.

To use the math operation to calculate pi, execute the following command:

[math]::pi

The output of this is shown in the following screenshot:

This simple command will provide PI ...

Get PowerShell: Automating Administrative Tasks now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.