Have you noticed how instructors and writers casually toss off phrases like "Edit the line in your Autoexec.bat", "Just write a batch file" and so on. For the beginner or the less-than-confident the prospect of editing or writing a file is an daunting idea. Contrary to some peoples expectations these files are not written with toad bile gathered at the full moon. They are written with ASCII (pronounced ASS-KEY, the initials of American Standard Code for Information Interchange) text editors which is, at first glance, even blacker magic. As a general rule you cannot write batch files and so forth with a conventional word processing package. There is one exception, that is PC-Write. The reason you cannot use most word processors to write DOS files is because the word processors put in lots of extra characters, like "tab", "carriage return", "bold" and so forth. generally they are instructions to the printer or reminders that the program puts there for housekeeping. DOS cannot cope with these extra characters. It blunders along trying to execute them and usually hangs or panics or gets the sulks. Most of the word processors have the ability to produce ASCII text. For reasons best known to programmers, who love to make computing confusing, all the different word processors give ASCII text different names. One calls it unformatted text, another calls it plain text and there is non-document mode and so on. Different names for the same thing. To write files to be used by DOS you must have an editor that produces none of these extra characters. There are plenty of them around. We all have EDLIN that comes with DOS. EDLIN has lots of knockers who decry it for what it does not do. They miss the beauty of its simplicity. You can write batch files for ever using five commands. Everyone can learn in 20 minutes all they need to know about EDLIN to last them for the rest of their lives. After that it is only a question of practice. There are other very good editors. PC-Write, Blackbeard and SPC are all very good. Much more sophisticated than poor old EDLIN and certainly the preferred choice if you are creating more than a page of text. There are text editors built in to Xtree, Norton and PCTools, all of which turn out pure ASCII text. You can use these to create or modify your files. DOS 5 comes with two editors. EDLIN and a cut-down version of the editor that comes with Quick Basic. They call it EDIT. It is very nice. Pull down menus and all the accoutrements of what is trendy in computing. It is thoroughly recommended. So you see there are plenty of tools around to write batch files with. However none of them will write a file for you. You must do that yourself. Getting to know how to use the editor is the first step in writing files. The next bit is writing the file. After that you can execute it and then debug it before you start to improve on it. Let's see what is involved in writing a simple batch file. First of all lets define what is a batch file.
A batch file is a file with a .BAT extension. DOS recognises these files as containing a series of commands, similar to the commands that you would otherwise enter from the keyboard.
If you were already in drive C: then nothing would happen. No harm done but useful if you were in any other drive. |