A while back I wrote a couple tips on how to use Windows PowerShell to do basic math. There was a comment on it that I saved in case I ever wanted to write a separate tip. This is that tip.
Let’s say I wanted to express a number in kilobytes. I could just use Windows PowerShell to divide by 1024, or I could do it like this.
Then the $InKB variable can be queried for the answer.
This will work for MB, GB, TB, etc.