Skip to main content

Featured

WIN ALL ACTEVETED LIFETIME

  Search for: Recent Posts Simple trick to install Windows 11 on an old PC Easy ways to activate Windows 11 for FREE without a product key Remove “You may be a victim of software counterfeiting” notification Windows Defender detects my scripts as “HackTool:BAT/AutoKMS” Quickly convert Windows Server Evaluation edition to the retail one Easiest way to remove the Windows watermark from your screen Categories Computer Tips Microsoft Software Products 2 ways to activate Windows 10 for FREE without additional software Posted by  Always Smile   in  Microsoft Software Products  /  Last updated on  August 26, 2021 As you know, Microsoft notified Windows 10 is “the last version of Windows” and explained that they will be focused on the development of powerful and new features under the guise of software updates instead of building a new version. This means there will be no Windows 11 or 12 in the future(*). So if you are thinking about an upgrade, this is the b...

my1

 

  1. 1
    Copy the file in Notepad.
TITLE Calculator
ECHO OFF
CLS
ECHO -by Ravi Raturi, XI B Nirmal Deepmala Pagarani Public School Shyampur, Rishikesh
:TOP
color 3f
Cls
ECHO ----------------------------------------------------
ECHO[
ECHO                    DOS CALCULATOR
ECHO[
ECHO ----------------------------------------------------
ECHO[
ECHO[
ECHO    + = Sum
ECHO[
ECHO    - = Sub
ECHO[
ECHO    / = Division
ECHO[
ECHO    * = Multiply
ECHO[
ECHO    ~ = Exit
ECHO[
ECHO[
ECHO ----------------------------------------------------
ECHO[
SET/P ch=" Enter Symbol "
IF %ch% EQU + GOTO:SUM
IF %ch% EQU - GOTO:SUB
IF %ch% EQU / GOTO:DIV
IF %ch% EQU * GOTO:MUL
IF %ch% EQU ~ GOTO:EXI
IF %ch% GTR . GOTO:Hel
:SUM
CLS
ECHO ---------------------------------------------------
ECHO[
ECHO                         SUM
ECHO[
ECHO ---------------------------------------------------
ECHO[
set /p A=" Enter First Number = "
ECHO[
set /p B=" Enter Second Number = "
SET /A C=A+B
ECHO[
ECHO ---------------------------------------------------
ECHO %A%+%B%=%C%
PAUSE
GOTO:TOP
:SUB
CLS
ECHO ---------------------------------------------------
ECHO[
ECHO                     SUBTRACTION
ECHO[
ECHO ---------------------------------------------------
ECHO[
set /p A=" Enter First Number = "
ECHO[
set /p B=" Enter Second Number = "
SET /A C=A-B
ECHO[
ECHO ---------------------------------------------------
ECHO %A%-%B%=%C%
PAUSE
GOTO:TOP
:DIV
CLS
ECHO ----------------------------------------------------
ECHO[
ECHO                      DIVISION
ECHO[
ECHO -----------------------------------------------------
ECHO[
set /p A=" Enter First Number = "
ECHO[
set /p B=" Enter Second Number = "
SET /A C=A/B
ECHO[
ECHO -----------------------------------------------------
ECHO %A%/%B%=%C%
PAUSE
GOTO:TOP
:MUL
CLS
ECHO ---------------------------------------------------
ECHO[
ECHO                    MULTIPICATION
ECHO[
ECHO ----------------------------------------------------
ECHO[
set /p A=" Enter First Number = "
ECHO[
set /p B=" Enter Second Number = "
SET /A C=A*B
ECHO[
ECHO ----------------------------------------------------
ECHO %A%*%B%=%C%
PAUSE
GOTO:TOP
:EXI
EXIT
:HEL
CLS
ECHO --------------------------------------------------
ECHO[
ECHO                         HELP
ECHO[
ECHO --------------------------------------------------
ECHO Press (+) For Sum, (-) For Sub, (/) for Division, (*) for Multiply.
PAUSE
GOTO:TOP
  1. Image titled Build a Simple Calculator Using Batch Script Step 2
    1
    Save the file as something like Calculator.bat. The best folder place for this file is in your My Documents(any OS besides Vista) or Documents(Windows Vista) folder.
  2. Image titled Build a Simple Calculator Using Batch Script Step 3
    2
    Double click on file and enjoy.

Community Q&A

  • Question
    Can this work even if I don't have an internet connection?
    Community Answer
    Community Answer
    Yes, everything you need is self-contained within the operating system.
Ask a Question

Tips

  • Batch is a fun way to start writing programs. To move onto something just a tiny bit harder but much more powerful try the python programming language.
  • Save frequently. You may regret it if you don't.
  • Try creating many versions of the game as you go so you can compare them and see if there are any errors. Don't worry about how much space it will take, batch files are very small.
  • You can find free videos on YouTube to learn any programming language.
  • You can set variable by putting "set variablename=value", or to get the user input and save it as a variable, instead of putting "set /p input=blahblahblah" You would put "set /p variablename=blahblahblah" (This paragraph has to be corrected.)
Submit a Tip
All tip submissions are carefully reviewed before being published

Warnings

  • Never put any MS DOS commands in the echo command, as they will be carried out. Remember that everything displayed by the command line is an echo!
  • Never put any MS DOS commands in the text files that are typed out to the console. Text files solve some problems, such as the slashes and stars, but commands in them will still be carried out by the system.
  • It is often times said that it is illegal to send batch files over the internet. By no means is this true, but be aware of the fact that you may get in trouble for sending dangerous batch files over the internet(e.g.: batch files that crash the computer, delete vital system files, etc...). They are not called viruses, but they are still harmful and you can get in serious trouble for them.

About This Article

wikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, volunteer authors worked to edit and improve it over time. This article has been viewed 47,206 times.
How helpful is this?
Co-authors: 8
Updated: May 31, 2019
Views: 47,206
Categories: Programming
Thanks to all authors for creating a page that has been read 47,206 times.

Is this article up to date?

 

Comments

Popular Posts