Batch files are text files that contain a sequence of commands generally used in system command prompt to perform various computer operations like starting programs or running system utilities, etc. In DOS and Windows, batch files are intended to be executed by the command interpreter. There are numerous computer operations that can be performed by using these .bat files. Through this short article we will know how we can create our own calculator by writing a few commands.
Open a notepad (or any other text editor) file and paste the following code in it:
@ECHO OFF
color 2a
title My Calculator
pause
ECHO —————————————- ——-
ECHO * = MULTIPLY
ECHO + = ADD
ECHO – = SUBTRACT
ECHO / =DIVIDE
ECHO —————————————- ——-
pause
color 2a
title My Calculator
pause
ECHO —————————————- ——-
ECHO * = MULTIPLY
ECHO + = ADD
ECHO – = SUBTRACT
ECHO / =DIVIDE
ECHO —————————————- ——-
pause
:loop
echo.
echo —————————————- ——-
SET /p UDefine=
SET /a UDefine=%UDefine%
ECHO =
ECHO %UDefine%
ECHO.
goto loop
Save the notepad file with a name say “calc.bat” where .bat is extension for batch files. Now click on the batch file icon and there opens your own calculator in command prompt window. You can also create an .exe file as well. Download a .bat to .exe converter to do this; one can be found here – http://www.f2ko.de/programs.php?lang=en&pid=b2e
Filed Under: How to
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.