How to Build a Simple Calculator Using Batch Script

Batch script is a basic scripting language that runs on any Windows or MS DOS operating system, the functions are based on the commands for the command lines in these operating systems. Also its pretty cool! Making a game with this script is not that difficult, all it takes is a little time and creativity. Please note: in order for this project to work properly, you will need Windows 2000 or higher, as this will not work in earlier versions of Windows or MS DOS, since MS DOS is not compatible with modern batch scripts.

Steps

Copy the file in Notepad.

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.

Double click on file and enjoy.

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.

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.

Leave a Comment