Web Analytics


Ever use the Windows Calculator and, because you’re too lazy to write numbers down or commit them to the calculators “memory”, end up with 5 instances of the program running—each with their own numbers that are easily forgotten? Or is that only me?

If you’d like a simple but powerful calculator to perform simple sums, PowerShell may be the tool you are looking for. In this guide, we provide tips for first-time PowerShell users, show you how to perform simple arithmetic using Windows PowerShell, and how to use command history for multi-step calculations and note taking.

Simple Arithmetic with Windows PowerShell

Tip: Open PowerShell by pressing the Windows key on your keyboard, typing power, and pressing the Enter key

PowerShell comes pre-installed on Windows 7 and Windows Server 2008 R2. If you’re using XP, Vista, or Windows Server 2008/3, download PowerShell here.

At the PowerShell command line, type in arithmetic (as you would while using Windows Calculator with the keyboard.) Here are the key symbols:

  • / Divide
  • + Add
  • – Subtract
  • * Multiply

You can start now by working out the answers to simple calculations:

That’s nice but… not very helpful. Windows calculator does that and it’s prettier :) PowerShell’s power lies in its command/output display history.

Use PowerShell Command History for Multi-step Calculations

If you want to keep track of numbers to use them in future steps, PowerShell can help. For example:

While comparing new TVs you see that LED backlit LCDs run at lower power than Plasmas. You want to factor this in to your purchase decision as a cost savings for LED:

  • Electricity cost: $0.09/kWh
  • Plasma average running power draw: ~220W
  • LED LCD: ~160W
  • Hours/day: 3
  • Years: 5

You can then work out how much both the Plasma and LCD will cost to run and find the difference. This is, of course, done without writing a single number down or committing anything to memory:

 

Now, PowerShell is starting to look useful. Wouldn’t it be nice to take notes and copy the output?

Add Notes and Save Input with PowerShell

If you’d like to keep track of your calculations, you can open a free-form text entry. One way to do this is to enter ‘ (single quote) at the command line. Then you can type notes; pressing enter will go to the next line; pressing CTRL+C will quit the editor.

Here’s an example:

Lines that start with PS are commands; lines that start with ‘>>’ are my notes

PS C:\Users\Rich> ' Notes:
>> $0.09/kWh
>> Plasma: ~220W
>> LED LCD: ~160W
>> Hours/day: 3
>> Years: 5
>>
>> Now, press CTRL+C to cancel out of this text but keep it on your screen for reference
PS C:\Users\Rich> '
>> Let's work out how many hours/year our TV will be on and work out the cost of running the TV for five years
PS C:\Users\Rich> 3*365*5*.09*.22
108.405
PS C:\Users\Rich> '
>> So that's 108.405 to run the plasma for five years. Now, you can recall the previous command by pressing the Up Arrow
 key, modify it (.16 kW instead on .22 kW)
PS C:\Users\Rich> 3*365*5*.09*.16
78.84
PS C:\Users\Rich> 108.405-78.84
29.565
PS C:\Users\Rich> '
>> There we have it. The energy cost (assuming 9c / kWh) difference is $29.57 over five years.
>>
>> Now, you can copy any of this text by highlighting it with the mouse and pressing the Enter key.

Now, highlight the text and press the Enter Key. You can then paste the test elsewhere (like I did for this post.) To paste text into PowerShell, copy it to your clipboard and then right-click at the PS command line.

Now, go impress your friends with your new “toy”

Bonus Tip

How many floppy discs will I need to store my 25GB Bluray rip? I bet you were wondering the same thing!

Answer: 17,778. So that’s $5,908.96 from Amazon and I’ll have two floppy discs left for half of my favorite song!

Blu-ray discs are pretty inexpensive in comparison!

What else do you do with PowerShell? Are you interested in learning more about this tool? Let us know in the comments.

About Rich

Rich is the owner and creator of Windows Guides; he spends his time breaking things on his PC so he can write how-to guides to fix them.

Free PC tips by email

Search Windows Guides




Comments

2 thoughts on “Use PowerShell as a Simple but Useful Calculator [How To]”

  1. Alexandra Lawrenz says:

    PowerShell seems pretty interesting, but still closely related to the
    average Windows calculator that’s already provided on the PC. What is one main
    feature that you think will draw users to download this calculator, and stop
    using the original calculator included in Windows?

  2. Jesferkicks says:

    Since PowerShell seems to be the de facto scripting machine for Windows now, anything and everything about PowerShell you care to convey will be helpful.  I bought a book on it but it provides one or two ways to do each thing.  This is Windows, I know there’s a ton of different ways to do everything.

Comments are closed.


Computer tips in your inbox
Sign up for the Windows Guides newsletter to get PC tips and access to free Windows books (More details)

Subscribe now
Popular Guides

See which sites have been visited on your PC (even if private browsing mode is used)

Create a Windows 7 System Repair Disc

Best Free Anti-malware

Hibernate vs. Sleep vs. Shut-Down

i3, i5, and i7; Dual, Quad, Hexa Core Processors. How to they Differ?

Intel's Ivy Bridge Processor: new Features

Windows Guides on Facebook