Before we start may I say thank you to all those readers who have written or phoned about this series. Nearly all have been complimentary, but the very small number of critical comments is also welcome, as is any help that may improve the standard of future episodes. Learning About DOS In our last episode I told you how I began learning about D0S commands, using my paperback book, PC-DOS which covered versions up to 3.1. Earlier I had related how my ex-colleagues helped me get started with 'borrowed' software, the first of which was DOS. I want to say to you all, as loud and clear as I can, that the use of borrowed or illegal copies of any proprietary software constitutes piracy and I don't approve of that. Although in my early days I used dubious software, I have since purchased and registered all the software I use. End of lecture! In my early days with a two-floppy drive XT I had only the DOS prompt, at which I typed the required commands to get my application program going. You may be luckier, but even though you have a DOS Shell, or menu system, you should be able to 'shell out to the DOS prompt. To do this, look for on-screen instructions or read your manual. You can 'shell out' of DOS 5 with Alt+F4 (which means hold down the control key while pressing F4). When back at the D0S prompt you can issue some of the many commands available in order to achieve your objective. Let's talk about these commands as I learned about them one by one. Formatting I have given this deadly command a section all to itself and put it before a general discussion on DOS commands. Formatting means taking the piece of virgin plastic with magnetic coating (e.g. a new floppy) and making it ready to be used by a DOS operating system. You can only write to, and store information on a formatted disk, and the formatting process must be appropriate to the drive and the disk you are using. Thus 360 kB floppies cannot be formatted In a 1.2 MB drive unless you tell the drive you want a 360 kB format. The actual job is done by a program supplied with DOS called FORMAT.COM, which many people delete from their hard disk or rename as something like FORMAT!!.COM. Why? Because FORMAT.COM deletes everything already on the disk. Recovery of your programs and data lost by accidental formatting is a job for experts - but even they may not be successful. Note that D05 5 provides a 'safe format and an 'unformat' command. PC Tools and some other utilities also provide 'safe' formats, but it is preferable not to have to use them. Users of earlier DOS versions should be aware of the deadly FORMAT. MSD0S 4.01, however, does give a warning message. Many times has my phone rang with an anguished call for help after someone has made unwise use of FORMAT. The command is just, FORMAT A: (or B: or C:) It is deadly because, if a drive is not specified, you will format the default drive, usually C:, so you lose the contents of the hard disk. Yes, everything! All you have to do is type the word FORMAT - the phone rings and, forgetting to type a drive name, you hit 'Enter' and bingo, it's all gone. There are several switches with FORMAT, and they vary somewhat with different DOS versions, so check your manual. Some switches allow you to give the disk a label, or put system files on the disk which is then called a 'System Disk'. You can boot your computer by putting a System Disk in drive A: before you switch on the power. Error Messages When using DOS the computer will sometimes 'tall to you through onscreen messages saying you have done something silly. Some examples are:
Filespecs One of the error messages I encountered rather frequently in my early days was 'File not found.' As a result I soon learned to use directories so that I was able to tell DOS exactly how to find the required file. This requires positive identification of the file to which the command is to apply. First I had to learn about directories even though at that stage I didn't have any. You will probably find life easier if you divide your hard disk into directories, each of which contains one program or group of programs. For example, all your word processing program files might be placed in a directory called 'WORDS.' Make this from the C:\ prompt by typing: md\words or MD\WORDS ('md' means 'make directory' and it does not matter if upper or lower case is used - DOS does not distinguish at this level). Copy your files into the new directory and the complete Path for DOS to find YOURFILE.TXT would then be: C:\WORDS\YOURFILE.TXT. More about directories later! From my paperback book I discovered that the positive identification mentioned above is done with filespecs, which give Drivename, Path, Name and Extension. The Drivename is just A:, B:, or C: as already discussed. The Path is the 'route' through directories and subdirectorles which DOS must follow to find the file. If the file DOS is looking for is in the same subdirectory or on the same floppy disk, then only Name and Extension are required to find the file. We will have to leave further discussion of the Path until we are into deeper water later in this series. The Filename is composed of a Name and an Extension separated by a period. The Name can be any combination of up to 8 letters, figures, or special characters. See your DOS manual for the permissible special characters and a list of 'reserved' names. The Extension may consist of up to 3 of the characters permitted for the Name. You use the Extension to label groups of files, to indicate dates or significant numbers. For example, I use the extension in correspondence files to give a year and number. When writing to our Editor, I might use IFARY.193, IEARY.293 etc., where the year is 1993 and the first figure is the number of the letter. However, note that DOS treats certain extensions in a special way, so you should not use those for your own naming. Examples are .BAT, .COM, .EXF, .SYS Note also (as already mentioned) that DOS names and commands are not case-sensitive, which means they can be entered in either capital (upper case) or small (lower case) letters. Wildcard Characters After (slowly) absorbing the above I became aware of "wildcard characters,' which are '?' and '*' and can also be used in filenames. '?' equals any single character and '*' equals any group of characters. Thus, If I want to select all the files associated with this series, which are named BEGTALE1, BEGTALE2, etc., I ask DOS to operate on BEGTALE?. But some of these BEGTALE files have different extensions, such as .ABC, .G4B, and .BAK. If I want all the BEGTALE files, I call for BEGTALE?.* to get all the BEGTALE files. I must use BEGTALE?.*. The description '*.*' therefore means all files, and 'del *.*' means delete all files. Warning. Although DOS 5 and some utilities have 'undelete' commands that can get you out of trouble, if you make a mistake and delete something you wanted to keep, stop, don't panic. If you continue working after the mistake, it becomes very difficult for 'undelete to successfully restore your work. In short, in the event of accidental deletion of a file or files, cease all activity and either use an 'undelete' utility immediately, or seek help. Copy Commands New starters will perhaps ask why copy commands are always the first to be mentioned in books and instructions on 'how to use your computer'. I know I did, but I've since found out that one does a whole heap of copying one way and another. There are three forms of copy commands. DISKCOPY We talked about DISKCOPY last month because it is one of the very first commands you should use. Whenever you buy a program, you should immediately put the little write-protect tabs over the notches in the side of 5.25 inch disks (they must be opaque), or move the little plastic square on 3.5 inch disks. An open hole in the 3.5 inch format means data cannot be written to the disk. Note that this is the opposite of the 5.25 inch disks. Having write-protected your precious disks, then use DISKCOPY to make copies of all your purchases. Then put the original disks away in a safe place (at least in a different room from the computer) and only use your copies in the computer after that. Write-protect the copies too, its a protection against virus attack. Remember that DISKCOPY makes the target disk into an exact copy of the source disk, meaning that anything already on the target disk will be wiped. Guess what Ron did, way back when...; yes, you got it first time, I DISKCOPYed away a whole floppy full of important data. Also be aware that DISKCOPY copies everything, including lost clusters, damaged FATS (File Allocation Tables) and invalid directory entries. It will even write over a bad patch on the target disk. You should use DISKCOMP after DISKCOPY to ensure that you have a good copy. COPY COPY is just that. The 'Syntax' (up-market jargon for how to make DOS understand what you want) is: COPY {Source filespec}{Destination fltespec}. An example would be COPY MYFILE.SEC A: which copies MYFILE.SEC from the default drive to the disk in your A: drive. The meaning of default drive was explained (I hope) at the end of Part 3 of this series. To copy a file from one directory to another (they don't have to be on the same disk) you need to use Filespecs. For example: COPY C:\DOCS\MYFILE.SEC A:YOURFILE.SEC. This copies MYFILE.SEC which is in the directory called DOCS on drive C: to a file called YOURFILE.SEC on drive A:. Use the command COPY MYFILESEC PRN to send that file to the printer (The use of the DOS PRINT command is not recommended). COPY is rather slow, and if you have only one floppy drive there is a lot of disk-swapping involved and you must be careful to put the right disk in, or some files could be lost. Well, its that time again, the Editor is holding up his hand for me to stop. We still have to cover a few of the commands which I had to know about in my 'New Starter' days. There are many more DOS commands which I'm not going to cover, and I'm sure some readers will disagree with my selection. If you do, please remember this series is not written for knowledgeable computer buffs, but for people trying to come to grips with a broad and at first confusing subject. Reprinted from the March 1993 issue of PC Update, the magazine of Melbourne PC User Group, Australia |