How to make a "Hello World" Batch File

Gir

New Arrival
Joined
Jun 29, 2009
Messages
14
Reaction score
1
FP$
7
Finished Work
@echo off
title Hello World!
echo Hello World!
pause

Open up any text editor, because batch doesn't need a compiler.
Now, I'm going to explain what each command we will use does.
-- @echo off -- Removes ""Watermarks"" in you're batch file.
-- title -- Sets the title of you're batch file.
-- echo -- Tells the batch file to ""say"" something.
-- pause -- Tells the command line to wait for the user to press any button to continue.
-------------------------------------------------------------------------------------
1.
So first to prevent this from happening
Code:
C:\Users\-\Desktop>title Hello World!

C:\Users\-\Desktop>echo Hello World!
Hello World!

C:\Users\-\Desktop>pause
Press any key to continue . . .
We will add the -- @echo off -- command
You don't want that ugly "C:\Users\-\Desktop>" then command name.
So the -- @echo off -- prevents that from showing.
---------------------------------------------------------------------------------------
2.
Next were going to add a title to the batch file, because if you don't you get a ugly header that says
Code:
C:\windows\system32\cmd.exe
Instead of that it will show
Code:
Hello World!
So now you should have
Code:
@echo off
title Hello World!
----------------------------------------------------------------------------------------
3.
Next we need the batch file to say "Hello World!" Right?
Well add the line
Code:
echo Hello World!
Save the file and so far we should have
Code:
@echo off
title Hello World!
echo Hello World!
-----------------------------------------------------------------------------------------
4.
Now if you save the file as a .bat with any name you can run it, but you notice, as soon as you open it, it closes! To prevent this we will add the -- pause -- command. If we have this command in our finished product if we open the file we get

Code:
Title : Hello World!
Hello World!

---
This tutorial was made by me, and it isn't hard, thanks for reading. -razz-
 
I have a better way,

Code:
@echo off
title Hello World!

:loop
echo Hello World!
goto loop

It is a looping version 😉
 
Yeah, but I think it is better as if you do it the other way and you want to make it echo loads you'll have to copy and paste.
 
The way you do it doesn't matter, they both do the same thing. It's just a different way of saying something 😉.
 
It's quite basic, but shows how to use the @echo off, echo and title command.
 
Hey I have done a prank in our school computers it was like this
Code:
color a
cls
@echo off
title PCHack v2.0

loop
echo You Have Been Hacked Do Not Try To Restart Or Close This Computer, If Then All Off Your Files Will Be Deleted
goto loop
 
Hey I have done a prank in our school computers it was like this
Code:
color a
cls
@echo off
title PCHack v2.0

loop
echo You Have Been Hacked Do Not Try To Restart Or Close This Computer, If Then All Off Your Files Will Be Deleted
goto loop
 
Back
Top Bottom