Pages

How to create a Batch Program (lesson 1)


Batch programs can be written using any of the text editors such as notepad, wordpad and so on, but notepad is the most often used text editor in such cases. 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, in this case I am saving this file as ‘first.bat’.

3. When you save the batch file, then the icon becomes like the below icon,



In Windows XP, the Batch file icon looks like above,



Windows 7 goes like this

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


5. You are done!