How to create your own calculator using DOS commands
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
:loop
echo.
echo ---------------------------------------- -------
SET /p UDefine=
SET /a UDefine=%UDefine%
ECHO =
ECHO %UDefine%
ECHO.
goto loop
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
No comments:
Post a Comment