Batch file tutorial-1
Beginning
This batch file tutorial is basically for the beginners who does not have no inial idea about batch files.
This tutorial is on how to make Batch file withNotepad...
Before the tutorial (Here are some basics!)
The words in ( ) are just Remarks...
echo on/off :
To Start off, there is the @echo off/on
and there is echo
and there is pause
Here is an Example!
Type this in Notepad and Save as Test.bat
and double click on it
Code:
@echo off
echo Hello This is a test
pause
it will look like this!
Code:
Hello This is a test
Press any key to continue...
Again open Notepad and Write:
Code:
@echo on
echo Hello This is a test
pause
Save it as test2.bat
click on it...it will look like this!
Code:
C:\Documents and Settings\User\Desktop>echo Hello This is a test
Hello This is a test
C:\Documents and Settings\User\Desktop>pause
Press any key to continue
So therefore...
If you put @echo on it will show the directory as you just saw.
but, if you put @echo off it will just show the words with no directories...understand so far?
Basically it's best to just use @echo off
Echo:
If you want to type a simple statement just type in echo and something in this case
echo Hello This is a test
Which will show only, Hello This is a test
Pause:
Pause will pause the Batch file, so that if you Press a Key the Batch will continue in this case it will exit because there is nothing left.
So try this.
Code:
@echo off
echo Hello This is a test
pause
echo I am testing pause
pause
This will show...
Code:
Hello This is a test
Press Any Key To Continue...
(When you Press a Key it will show...)
I am testing a pause
Press Any key to continue
So that covers the "Pause" Command. Smile
msg and cls:
Now some more commands...
There is msg *
And there is cls
Open Notepad and Write:
Code:
@echo off
echo Hello This is a test
pause
cls
echo I am testing pause
msg * The End
pause
Save as test3.bat
This will show...
Code:
Hello This is a test
Press Any Key To Continue...
(when you press a key it will show)
cls
(the page will clear)
I am testing a pause
(a pop-up will show saying The End)
Press Any key to continue..
So...cls will just clear the screen
And msg * will bring up a pop-up (Simple right?)
now the rest part will be covered in next article....
Leave a Comment