Adding up numbers in PowerShell


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?


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


Adding up numbers in PowerShell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply