howtothings.co.uk
(Batch) Hello world - Your first Batch program - Printable Version

+- howtothings.co.uk (https://www.howtothings.co.uk)
+-- Forum: Computing (https://www.howtothings.co.uk/forumdisplay.php?fid=4)
+--- Forum: Programming Support, Graphic Design and Tutorials (https://www.howtothings.co.uk/forumdisplay.php?fid=14)
+--- Thread: (Batch) Hello world - Your first Batch program (/showthread.php?tid=5)



(Batch) Hello world - Your first Batch program - Mark - 22-05-2010

How to make a Hello World script in batch.


STEP ONE:

Open up notepad, if you dont know where notepad is you can open it via run (Win+R) and typing notepad.exe


[Image: 2he9erm.jpg]


STEP TWO:

The first thing we type is " @echo off " this simply hides the current directory location of where the file is being run from.

The next thing we type is the writing that you'll see, this can be anything but for this we are using " Hello World ", so you'll type " @echo Hello World ".

[Image: kebsp2.jpg]


STEP THREE:

You may have noticed a problem when you open the file, a black box appears but then closes straight away. This can be fixed by typing " pause " at the end of the file.

[Image: 2nvz5n4.jpg]


STEP FOUR:

When opened, our finished file should look the same as below.

[Image: zlat10.jpg]


STEP FIVE:

- Saving the file

Go to File > Save As...

File name: anything.bat
Save as type: All Files
Encoding: ANSI

I hope this has helped.