Sunday, June 13, 2010

My simple batch file tutorial [Part 2]

Okay , as I said in previous part , you just need to have a ANSI supported text editor (Notepad in the default Microsoft Windows installation should be suffice). It is so simple that you can typically do it in any of computers with Windows OS installed without the needs of extra programs.

By the way , ANSI means (American National Standards Institution) and feature more characters compared to ASCII.

To take the first baby steps, we learn how to broadcast standard "Hello World!" message in Window Vista ( though it might as well works in Window XP ! ) .
First of all, open up the Notepad programs.

In window Vista, just type the world "note" should be suffices and double click the notepad icons and you should have empty template.

From this points of tutorial onward, every highlighted line is the source code line

Type / Copy the following codes below:

@echo off
echo Hello World !
pause


Simple enough right ? Then , save the files with any names and any file locations as you like but you must select the *.* All files and save as bat format (.bat) with ANSI encoding (To prevent any complications). If you would like save as hello.bat  .



If you done it right, you should be able to see the following icons on your selected save file locations (E.g: I save hello.bat on desktop therefore I should see a similiar looking icons on Desktop)


If you had seen it, congrats yourself if you really do not have programming backgrounds because you create a first working programs. Although it is just a simple broadcast message but we got to start from somewhere right ? 

Double - click the bat files  and you should see the results of your programs.


Just follow the instructions and press any keys to continue to close the batch programs.

In next part of batch file tutorial, I shall discuss the meaning of each of the words. You can try figure it out by yourself though ! :)

No comments:

Another random post to read ? Come !

Related Posts with Thumbnails