PDF download Download Article PDF download Download Article

Making calculations using Windows calculator can get very tedious. Creating your own Command prompt calculator will make your life much easier.

  1. Click the Start menu and type "notepad". This will be the first option.
  2. Highlight the entire code, right-click it, and click Copy.
    • @echo off
    • :start
    • Echo Press 1 for Addition
    • echo Press 2 for Subtraction
    • echo Press 3 for Multiplication
    • echo Press 4 for Division
    • echo Press 5 to Quit
    • set /p type=
    • if %type%==1 goto a
    • if %type%==2 goto b
    • if %type%==3 goto c
    • if %type%==4 goto d
    • if %type%==5 goto e
    • :a
    • echo Addition
    • echo Please choose the 2 numbers you wish to add
    • set /p num1=
    • set /p num2=
    • echo %num1%+%num2%?
    • pause
    • set /a Answer=%num1%+%num2%
    • echo %Answer%
    • pause
    • goto start
    • :b
    • echo Subtraction
    • echo Please choose the 2 numbers you wish to subtract
    • set /p num1=
    • set /p num2=
    • echo %num1%-%num2%?
    • pause
    • set /a Answer=%num1%-%num2%
    • echo %Answer%
    • pause
    • goto start
    • :c
    • echo Multiplication
    • echo Please choose the 2 numbers you wish to multiply
    • set /p num1=
    • set /p num2=
    • echo %num1%*%num2%?
    • pause
    • set /a Answer=%num1%*%num2%
    • echo %Answer%
    • pause
    • goto start
    • :d
    • echo Division
    • echo Please choose the 2 numbers you wish to divide
    • set /p num1=
    • set /p num2=
    • echo %num1%/%num2%?
    • pause
    • set /a Answer=%num1%/%num2%
    • echo %Answer%
    • pause
    • goto start
    • :e
    • echo. Done!
    Advertisement
  3. Right-click the empty area in the Notepad and click Paste.
  4. Click File, and then click Save As....
    • Change the "Save as type" box to "All Files"
    • Type "anything.bat" into file name and click "Save".
  5. This will open it. You'll see a window with listed instructions.
  6. Your answer will be displayed.
  7. Advertisement

Community Q&A

Search
Add New Question
  • Question
    Do I save this code on the desktop?
    Community Answer
    Community Answer
    You can, yes.
  • Question
    Why are the decimal places not shown for division?
    Community Answer
    Community Answer
    The set /a command (used for doing the mathematical operations) cannot display decimal places, so it rounds it down in all cases.
  • Question
    Step 4 is done. What do we have to do in step 5?
    Community Answer
    Community Answer
    Try it out!
See more answers
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement

Tips

Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!

About This Article

Luigi Oppido
Co-authored by:
Computer & Tech Specialist
This article was co-authored by Luigi Oppido. Luigi Oppido is the Owner and Operator of Pleasure Point Computers in Santa Cruz, California. Luigi has over 25 years of experience in general computer repair, data recovery, virus removal, and upgrades. He is also the host of the Computer Man Show! broadcasted on KSQD covering central California for over two years. This article has been viewed 136,386 times.
How helpful is this?
Co-authors: 16
Updated: December 16, 2023
Views: 136,386
Categories: Command Prompt
Thanks to all authors for creating a page that has been read 136,386 times.

Reader Success Stories

  • Talha Ali

    Talha Ali

    Jun 15, 2016

    "This article helped me in making a calculator. I love wikiHow."
Share your story

Is this article up to date?

Advertisement