Basic Batch [TUT]
Page 1 of 1 • Share •
Basic Batch [TUT]
Recently I have been thinking that A few batch tutorials would be helfull to the forum.
So here is my first tutorial that I call Basic Batch.
The first of the batch commands I am going to teach you are the '@echo off' and the 'Echo' commands
This can be used in 2 cases, one use can be @echo off, this will tell the batch file not to show the command(s) it is running underneath the '@echo off' just the output (from them).
Then the @echo on command can be used this tell the batch file the opposite basically.
Example:
(Too use this open a notpad file and paste the code into it, click save as, and put the filename as test.bat and then cahnge then change the file type to "all files")
You may have noticed the 'Echo' there, this indicates to show the user any text typed after echo.
You may have also noticed the pause, this indicates to wait until the user presses a key.
We could also add markers to that, markers work by setting ''checkpoint'' in the batch file which can then be used to jump back or fourth in the batch file.
Example:
The marker is set by typing :[any word here] and then using the 'goto' command to skip[ back to it.
Notice I also used a '> NUL' after the pause, this indicates for the batch file not to display the usual "press any key to continue..." message, instead it display's nothing, So I wrote my own message 'Echo smash keyboard to continue....'
That concludes this tutorial check out my other posts for any other tutorials on batch programming.
Kieron xD
So here is my first tutorial that I call Basic Batch.
Basic Batch
The first of the batch commands I am going to teach you are the '@echo off' and the 'Echo' commands
@echo off
This can be used in 2 cases, one use can be @echo off, this will tell the batch file not to show the command(s) it is running underneath the '@echo off' just the output (from them).
Then the @echo on command can be used this tell the batch file the opposite basically.
Example:
- Code:
@echo off
Echo Hello world!
pause
(Too use this open a notpad file and paste the code into it, click save as, and put the filename as test.bat and then cahnge then change the file type to "all files")
Echo
You may have noticed the 'Echo' there, this indicates to show the user any text typed after echo.
You may have also noticed the pause, this indicates to wait until the user presses a key.
We could also add markers to that, markers work by setting ''checkpoint'' in the batch file which can then be used to jump back or fourth in the batch file.
Example:
- Code:
@echo off
:loop
Echo Hello world!
Echo smash keyboard to continue....
pause > NUL
goto loop
The marker is set by typing :[any word here] and then using the 'goto' command to skip[ back to it.
Notice I also used a '> NUL' after the pause, this indicates for the batch file not to display the usual "press any key to continue..." message, instead it display's nothing, So I wrote my own message 'Echo smash keyboard to continue....'
That concludes this tutorial check out my other posts for any other tutorials on batch programming.
Kieron xD
Last edited by Admin on Mon May 18, 2009 7:31 pm; edited 1 time in total
Logic_Bomb- Admin
- Posts : 161
Join date : 2009-05-12
Age : 26
Location : Cyberspace
Re: Basic Batch [TUT]
Nice tutorial for those who are just entering the ways of batch.
I look forward to Intermediate and Advanced ^^
REP+
-Oliver.
I look forward to Intermediate and Advanced ^^
REP+
-Oliver.
Oliver- Admin
- Posts : 8
Join date : 2009-05-14
Age : 24
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum