Converting VBScript's Exponentiation Operator

Definition: Raises a number to the power of an exponent.

Exponentiation Operator

Interestingly enough, Windows PowerShell doesn’t have a built-in exponentiation operator. So does that mean you’re out of luck if you need to raise 8 to the third power? Of course not; all you need to do is use the System.Math class and the Pow method:

$a = [math]::pow(8,3)

When you run this command and then echo back the value of $a you should get the following:


Return to the VBScript to Windows PowerShell home page