How to Write a DOS Script
Instructions
1Create an algorithm to determine precisely what you want the DOS script to do. This will help choose the appropriate commands and the order in which to use the commands.
2
Open your text editor and type the commands in one line at a time. As you type, imagine that each time you hit "Enter" your command will be executed. This will help ensure you have the proper command with all the necessary parameters in place.
3
Save the text file as a batch file. Most text editors will save a file with a ".txt" or ".rtf" extension, so you will have to change it to a ".bat" extension. For example, a batch file might be named "script.bat."
4
Run the batch file by typing the name of the file without the extension and pressing "Enter." Evaluate the performance of the script and if there are any errors, open the batch file in your text editor and correct them. Your command line must be pointing to the same directory as your script for it to run.
Source...