|
Carbonize | ||||
| >>>>> Free Adidas fragrance sample (UK only) <<<<< | |||||
|
To have your message appear here simply send an SMS to +31641303196 and start your message with 9013 and a space |
|||||
Batch FilesA batch file is to DOS what a macro is to Microsoft word. Basically it's a set of preprogrammed commands. So instead of having to open DOS and type in all the commands manualy you can write a batch file to do it for you.In this tutorial I will be listing most Batch file commands. As a Batch file is just a list of DOS commands this will also be a list of DOS commands :) Two for the price of One. I will include some minor examples of how to use some of the commands.
Remember - anywhere you have to supply a file or folder name, either for creation, reading, or deleting, you can put the full path such as 'DEL C:\windows\desktop\*.txt' would delete all .txt files on the desktop (remember that different versions of windows have different paths). Parameters - To do parameters in a batch file we use %x (%1, %2, %3 etc). So ECHO %1 %2 %3 would display parameter 1 parameter 2 parameter 3. To better understand make a batch file called abc (just open up notepad and save the file with a .bat extension) with the following code - @ECHO 1 = %1 2 = %2 3 = %3Now place the batch file in your C drive and goto Run. Now type in 'C:\abc.bat x y z.'Displayed we see '1 = x 2 = y 3 = z'(if it closes to fast put the PAUSE command on a new line after the '@ECHO 1 = %1 2 = %2 3 = %3'). We give our parameters in our call to run the bat file. The parameters are seperated by spaces. Goto Run again but this time put - 'C:\abc.bat abc cry oz'Displayed we see '1 = abc 2 = cry 3 = oz'You should know understand how parameters work. As you can guess we can only have 9 parameters (1 - 9). But there is a way to use more. We do this using the SHIFT command. What shift does is delete parameter 1, then make parameter 2 parameter 1, parameter 3 becomes parameter 2. to demonstrate we're gonna make the ABC.BAT batch file again with the following commands - @ECHO OFF ECHO 1 = %1 2 = %2 3 = %3 SHIFT ECHO 1 = %1 2 = %2 3 = %3Now goto run and type - 'C:\abc.bat abc 123 xyz 456'Yes the file only uses 3 parameters but it will ignore any over the required amount. Displayed we see this - '1 = abc 2 = 123 3 = xyz' '1 = 123 2 = xyz 3 = 456'Hopefully this should explain how shift works. The first parameter is emptied then all the others are moved up a place. There are a lot more commands you can use in Batch files and in DOS but this is just meant as a introduction and not a full blown tutorial. Carbonize |
||