Using+DOS+.bat+(batch)Files

//** For those who are curious about .BAT files, they are a quick way to do things that Windows doesn't do very well. The come from the "old" days when all commands had to be typed in DOS. You can still open a DOS window if you like, but you don't have to: Start/Programs/Accessories/Command Prompt. Batch files work in regular Windows. They are called "batch" files because things can be done in bunches and batches over and over. A couple of clicks does the work.
 * //Submited by Wudpecker

To make a .BAT (or .bat) file: 1) Make a new text file. ---Or open up a file already named .txt and wipe out all the information in it so you can type your own.

2) Type in your DOS commands (See below for a list, and some common commands) 3) If you want to see your DOS window in operation, type: PAUSE --at the very end. Otherwise, the .bat file goes by so fast you can't read it. 4) "Save file As.." with a new name and add the .bat at the end instead of .txt If you want to give directions or information before typing in your commands, start with ECHO OFF (avoids duplicates) REM (makes a space--it's short for "REMark") REM (type in your comments. The DOS window is small, so keep them short or make another REM to continue. You can use lower case, too) REM (another space) Then your commands. At the very end, type: PAUSE --to see your message and commands in operation. EXIT to get back to Windows. Usually, this is automatic and not necessary. And you DON'T have to worry about CAPITALS or "lower case" in your commands. DOS sees everything as capitals, except in Windows XP. But you do have to worry about spaces. DOS does not understand long filenames with spaces-- (though Windows XP DOS will handle them in many cases).

4) You are done. Then, when you click on this file Windows will automatically call up DOS and execute it. You don't have to open a DOS window to make a .BAT file. Windows recognizes the .bat extension. You can edit an existing .BAT file by right-clicking on it and choosing "edit".

Batch files can be a great time-saver. This is what Shreck meant by asking for a program that does the work.... quote: ....by a dble click and converts an entire folder at once option so as to not have to type in a million command lines into a bat file just to convert TPC to PCXs That's exactly what .BAT files were designed for. But you sometimes have to type in a lot of command lines the FIRST TIME you set up a batch file. After that, a double-click will run it. Luckily for him--and you--**almost every .BAT file you need in EAW has already been created by somebody**. Check "Tally Ho" at Sandbagger's and other EAW sites.

To open a DOS window: Start/Programs/Accessories/Command Prompt If you right-click on "Command Prompt" you can make a shortcut for the DOS window and put it on your desktop for instant access.

Here is a pretty complete list--and more DOS info: http://www.xmission.com/~comphope/msdos.htm#02 You can type any of the DOS commands into a DOS window, followed by a space and a /? DOS will tell you what it does. or
 * WHAT ARE THE COMMANDS?
 * The list is long. But only a few are used any more because DOS is "sorta" out of style. Plus Windows XP in particular won't let you use all DOS commands. They are too powerful.
 * ren /?**
 * help rename** will do much the same thing.

TWO COMMON DOS COMMANDS: COPY---Type in **copy A-file B-file**. So A-file is copied and renamed B-file. Notice the spaces between "**copy A-file B-file**".. Notice you don't have to use capitals--DOS sees everything as capitals, except in Windows XP. And XP DOS still reads small letters. This is handy when you want a copy of a file and Windows won't let you use a duplicate name in the same directory. You get a copy with a new name. Too much trouble? Suppose you want to copy all your .bat files and rename them .txt files so you can read them as text.
 * COPY *.BAT *.TXT (or copy .*bat *.txt** in Windows XP) will copy and change all such files.

RENAME (or REN ,for short)---As in **ren A-file B-file**. You don't get a copy this way. But you can rename whole file types in a bunch, like RAF_Roy's example of renaming some graphics files in EAW: Roy has renamed ALL files named **.cip** to files ending in **.pcx** by using the "wildcard" star.
 * ren *.cip *.pcx**

WILDCARDS-- The *** (star),** means "everything until the next letter". A **? (question mark)** means "anything in this single letter space". Nobody uses the ? question mark much, though.

copy *.* will copy everything. copy *.txt will copy everything named .txt copy A*.* will copy anything starting with an "A" copy A*.txt will copy anything starting with an "A" and ending in ".txt" The ? question mark is sometimes used to pick out a particular space: copy *ABC?DE2.txt.

BigA.txt to BIGA.DOG smalla.txt to SMALLA.DOG MiddleA.txt to MIDDLEA.DOG
 * COPY** ***A.txt *A.dog** will copy and rename all of these automatically in regular DOS:

XP DOS WILL LET YOU USE SMALL LETTERS: (Notice it followed directions and changed the second "A" to a capital letter ) MiddleA.txt to MiddleA.dog WHEN WILDCARDS WON'T WORK Roy had to type in every terrain file in his long DOS .bat file: gpmTpc2Pcx.exe BNALCTY.ter gpmTpc2Pcx.exe BNALCTY2.ter gpmTpc2Pcx.exe BNALCTY3.ter gpmTpc2Pcx.exe BNALCTY4.ter gpmTpc2Pcx.exe BNALCTY5.ter gpmTpc2Pcx.exe BNALCTY7.ter, etc. (Of course what he really did was copy each line and then change only the numbers) Trying to do this won't work: gpmTpc2Pcx.exe BNALCTY*.ter Why? DOS has no clue that you want them numbered and done in order.
 * copy *a.txt *A.dog** will give you:
 * smalla.txt to smallA.dog**
 * BigA.txt to BigA.dog

Smart simmers like Shreck will ask in the forums if there's a DOS batch file available for EAW stuff if they can't find one searching at Sandbagger's or elsewhere. Usually, one exists already.

PRINT or COPY YOUR DIRECTORIES Hey, here's a neat .bat file trick ---or even use it for a DOS window: It makes a file list of everything in a directory, and puts the list in a form you can copy or print out. Why is that neat? Try copying the name of a program like EAW.exe into a text file. Try copying the entire directory into a text file. Won't work, right? This will. The .bat file can be one line. Put in your own file name. Example: DIR /b>magoo.txt makes a file with all my "Magoo" directory inside it.
 * Dir /b>filename.txt**

The /b is for "bare" without comments. The > dumps the directory into whatever file you name.