Adding up numbers in PowerShell

powershell, shell

Solution

PS H:\> $value1 = 10
PS H:\> $value2 = 10
PS H:\> $value1 + $value2
20

If your numbers are stored as strings then you'll need to cast them to integers like this:

PS H:\> $value1 = "10"
PS H:\> $value2 = "20"
PS H:\> [int]$value1 + [int]$value2
30

Problem

I am trying to add up two numbers in PowerShell. I have the input the user gives stored in `$Value1` and `$Value2`. However I can't find any way to actually add these numbers up. I tried using the `Measure-Object` cmdlet but I can't seem to get it to work. How does one add up/substract and multiply numbers in Powershell?

Original source