What Are Batch Files & How to develop Batch Calculator?


                      BATCH FILES


Batch files allow MS-DOS and Microsoft Windows users to create a lists of commands to run in sequence once the batch file has been executed. For example, a batch file could be used to run frequently run commands, deleting a series of files, moving files, etc. A simple batch file does not require any special programming skills and can be done by users who have a basic understanding of MS-DOS commands.

A good example of a batch file for someone who is more familiar with Windows or the MacOS is to think of a batch file as a shortcut in Windows or an icon on the MacOS. Much like a shortcut, batch files could be used to run one or more commands or programs through the command line.

Another example of a very well known batch file is the autoexec.bat, which is a simple boot file loaded each time the computer is loaded on MS-DOS and early Windows computers. This batch file contained all the necessary commands and programs used to run MS-DOS and Windows each time the computer booted.



PICTURE: MS DOS BATCH FILE


Basic Calculator In Batch




Basic calculator written in batch. Copy the given text & paste it onNotepad, save it as calc.bat

Code:

@echo off
title Batch Calculator
echo -------------------------https://pkc456.blogspot.com/-------------------------
:1
echo Enter the values with operands (E.g. 1+1):
set /p input=
set /a result=%input%
echo Result is: %result%
:2
echo Wanna continue? Press Y for yes Or N for No
set /p "choice=>"
if %choice%==Y goto 1
if %choice%==N goto end
echo Invalid choice
goto 2
:end
exit



You can also download the text fie from here:BATCH CALCULATOR

PICTURE: BATCH CALCULATOR


Popular posts from this blog

Play youtube video in iOS app

Disabling print for Production In Swift Project

Exception Handling - Objective C