Tuesday, September 9, 2014

How to create a Batch Program:

Like any other programing languages, lets start our first program with the ‘Hello World’ program.
1. Open up a notepad and type the following.
@echo off
Echo Hello World
pause

2. Save the file with any name you wish, but make sure that you save the file extension with .bat, inthis case I am saving this file as ‘first.bat’.

3. Just double click to execute the batch file that you have created now. And the output looks like,




4. You are done!

Introduction


Batch file programming is the native programming offered by the Microsoft Windows Operating
System. Batch file is created using any text editors like notepad, WordPad, WinWord or so on, which
comprises of a sequence of built-in commands used to perform some often done tasks like deleting a
series of files of same type or of different type, creating logs, clearing unwanted craps from your
computer and even for creating a batch VIRUS.

Whenever a Batch program is executed, it was interpreted line-by-line by the CLI (Command Line Interpreter) command.com or the cmd.exe. Batch file is really helpful in automating tedious tasks and for maintaining system logs. The commands used while creating a batch file are case insensitive, in the sense that it may accept both small and upper case letters.


Modes:


1. Interactive mode :

 In this user interaction is required.


2.Batch mode : 

User interaction is not required.