CHAPTER 1

Introduction to DOS

By John P. Abraham, Ed. D.

 

Those of you who want to print this document from my web site, please email me for permission at this address: jabraham@panam.edu. I always give permission; the email is for courtesy only.

This manual is written for students in my CS1380 class (Introduction to Computer Science - Pascal), and it is based on Turbo Pascal version 5.0 and MSDOS 6.2. If you are using the windows version of Turbo Pascal all programs should work fine. You need to add one line right after the program heading, the line is given in italics. Uses wincrt; It is not my intention to replace the manual that comes with Turbo Pascal or your textbook. Instead, I have given you some specific examples that might be useful in solving problems assigned in class.

You are expected to have some background in operating an IBM PC or compatible computer. If you do not have any experience with MSDOS, you should take this manual to one of our computer labs and practice all the exercises in the MSDOS section of this chapter. It is essential that you know MSDOS before attempting to do Pascal programming. If you have no background in PC use at all, you need to study Appendix 1A at the end of this chapter.

At the minimum you should know how to do the following:

1. How to turn the computer and printer on and enter date and time.

2. How to change and ask for directory information.

3. How to create a small file using COPY CON or EDLIN.

4. How to type the contents of a file to the screen or to the printer.

5. How to format a disk (1.2 meg or 360 K).

6. How to name a file (eg:\PASCAL\STUDENT\ASSNMNT1.PAS)

7. How to copy a file.

MS-DOS

MS-DOS is the disk operating system for IBM-PC compatibles. The disk operating system used by IBM microcomputers is called PC-DOS. Hereafter we will refer to it as the DOS. The DOS was originally released in 1981 as version 1.0. Several revisions were made to it since then: the latest version at the time of this writing is DOS 5.0.

DOS compatible computers can be operated with floppy disks or a Hard Disk. All instructions in this manual assume you are using a hard disk.

 

 

 

ABOUT MS-DOS COMPUTERS

The computer you are using might be a 8088 based PC (with a hard drive it is called an XT), 80286 based AT, or a 80386 based AT. They differ in speed, expansion capabilities and bus architecture.

There are two types of key boards, the standard key board, and the expanded 101-key key board. The expanded key board has the cursor keys separated from the numerical key pad. You must have the NUM-LOCK on to use the numerical key pad. There are some special purpose keys which can be programmed; they are the function, arrow, escape, insert, delete and break keys. Most commercial programs make use of these keys for issuing commands to the program. There are two other keys, control and alt, which are used similar to the shift key, i.e. these keys must be held down while pressing another key. For example, Ctrl-C (written as ^C) is entered by holding down the control key and pressing C.

Monitors are either monochrome or color. Monochrome monitors come either in green or amber. The color monitors are either CGA, EGA, or VGA. They differ in resolution and number of colors they produce. Most programs need to be told what type of monitor you are using.

There are three different types of disk drives typically called: hard disks, floppy disks and optical storage disks. Hard disk drives range 10 Megabytes to over 300 Megabytes. Floppy disks can be 5 1/4" with a capacity of 360 K or 1.2 meg, or 3 1/2" with a capacity of 720 K or 1.4 meg. Optical storage disks are usually referred to as CDROMs (compact disk read only memory); however, CDs are also now available as WORMs (write-once-read-many). A more recent technology allows CDs to be used to write many times. DOS versions below 4.0 have a maximum limitation of 33 megabytes. Therefore, larger drives are divided or partitioned so that DOS will see them as different drives (C: D: E:, etc.). DOS 4.01 will recognize the entire drive as one volume.

FORMATTING DISKS.

Most disks are not ready to be used when they are purchased; they need to be formatted. Re-formatting is seldom necessary. Do not re-format the hard disk unless it is absolutely necessary! If you are using a computer in one of our labs, you should NEVER format a hard disk drive. Also, do not format any floppy disks you borrow from the lab. You can format your own floppy disks as described below.

1. Turn the computer on without a disk in drive A:

(computer will boot from the hard disk drive).

2. Enter date and time, if requested.

3. You need to have access to DOS programs to run the format program. Type format A: and press return. If it gave an error message (Bad command or file name), then you do not have access to DOS programs. DOS programs are usually kept in DOS sub-directory, if so, type CD\DOS and press enter. Then try formatting again.

4. The format command without any options will check what type of floppy drive you have and format the disk accordingly. However, if you wish to format a 360K disk in a 1.2 Meg drive, you need to add an option to the command. FORMAT A:/4 will do this for you. If you wish to format a 720K disk in a 1.4 meg drive then you should use FORMAT A: /N:9.

HOW TO NAME A FILE.

A file name has three parts: device, file identification, and an extension. Examples:

A:WORKFILE.TXT C:FORMAT.EXE B:MYFILE.PAS

The device name should have colon. The file identification can have up to 8 characters. The extension can have up to three characters and is optional. The extension is usually used to indicate the type of file (such as text file, executable file, or pascal file). If you do not specify the device name, then DOS will use the current drive you are using (default drive).

HOW TO WORK WITH DIRECTORIES.

Upon booting the system the computer uses the root directory. The root directory is indicated by a back slash (\). In order to see the files in the root directory just type DIR and press enter. File names and subdirectory names will be displayed. In order to change the working directory you can use the command CHDIR (OR CD). For example if you wish to change working directory to WP (Word Perfect) type:

CD \WP <PRESS ENTER>

Once you are in a subdirectory, you can ask for directory of that area by typing DIR and pressing enter. In this class you will not be asked to create new subdirectories; however, the command for creating new subdirectories is MKDIR (OR MD).

If you wish to see what directory you are in as you change from one to another you can issue the following prompt command:

PROMPT $S$P$G$

HOW TO CREATE A FILE USING COPY CON.

You can copy whatever that is typed at the console (keyboard) to a file. For example, if you wish to create a small file containing your name, social security number and assignment information, follow these steps:

COPY CON ASSNMENT.TXT PRESS <ENTER>

JAIME GARZA PRESS <ENTER>

432-33-4892 PRESS <ENTER>

CS 1380.3 PRESS <ENTER>

LAB ASSIGNMENT #3 PRESS <ENTER>

^Z PRESS <ENTER>

The control Z (^Z) is an end of file marker. When the copy program sees this control character, it stops reading the keyboard and writes whatever that was typed in to a file called ASSNMENT.TXT.

You can create files using any text editor, such as the Turbo Pascal Editor, or the line editor provided with DOS, EDLIN.

 

HOW TO PRINT CONTENTS OF A FILE.

There are different ways by which the contents of a file can be printed. Only text files (ASCII) can be printed; Binary files and graphics cannot be printed using the DOS commands given below. Here are some examples:

COMMAND FORMAT COMMENTS

--------------------------------------------------------------------------------------------

COPY ASSNMENT.TXT CON Displays on the screen

COPY ASSNMENT.TXT PRN Sends to the printer

TYPE ASSNMENT.TXT Displays on the screen

TYPE ASSNMENT.TXT >PRN Sends to the printer

TYPE ASSNMENT.TXT >LPT1: Sends to printer #2

PRINT ASSNMENT.TXT Queues to the printer

HOW TO COPY A FILE.

An existing file can be copied to another sub-directory or to same directory using a different file name. To do this use the copy command. The first file name is the file you want to copy and the second file name is the destination. Examples:

All examples assume ASSNMENT.TXT is in the default directory.

COPY ASSNMENT.TXT \PASCAL\ASSNMENT.TXT

Copies Assnment.Txt to Pascal Sub-directory. Since you are using the same file name you can omit that. COPY ASSNMENT.TXT \PASCAL does the same thing.

COPY ASSNMENT.TXT FIRST.TXT

Copies Assnment.Txt to First.Txt.

COPY ASSNMENT.TXT B:

Copies Assnment.Txt to floppy drive B:

When the source file is located in another directory you will have to indicate that also. Example:

COPY \DOS\COMMAND.COM A: Copies Command.com file from the DOS Subdirectory to disk in drive A:

 

APPENDIX 1A

COMPUTER AS A SYSTEM

Since all of us have used a stereo system, an analogy would be appropriate. Notice that all components are connected to the amplifier (main unit). It could have a turn-table, tape deck, speakers and other such peripherals attached to it. The amplifier receives an input signals from the turn-table, it processes the signal and sends it to the speakers (output). A system essentially has the following components.

 

INPUT ------>| PROCESS |---------> OUTPUT

A stereo system described so far can be termed the Hardware of the stereo system. The hardware does not produce any music until we play a record. The music recorded on the album can be called the software.

Now to a computer system. The hardware of a computer system also is composed of the processor and a number of peripherals. Again, the hardware alone does no useful work; it must be provided with the necessary software.

COMPUTER HARDWARE

The computer hardware is composed of the processor, the input devices and the output devices. Most commonly used input device is the keyboard and output device is the monitor. There are some devices that do both input and output, they are referred to as I/O devices. A disk drive is an excellent example of an I/O device.

COMPUTER SOFTWARE:

Computer software is a bit more difficult to explain than the software for a stereo system. Even though most of the software comes on magnetic media, software can also come on computer chips already attached to the system. To distinguish this type of software, it is sometimes referred to as firmware.

All of us have been taught how to do things by our parents, teachers and friends. We retain a lot of this information in our brain and we try to write down the rest. So when we need information that is not stored in our brain, we look it up in our notes or books (auxiliary storage). Computer is somewhat the same way, instructions can be placed in the computers main memory (RAM and ROM) which can be accessed by the computer quickly. Computers can also read information from auxiliary storage such as a disk.

TURN THE COMPUTER ON

1. Turn on the printer.

2. Turn the monitor on.

3. Turn the computer on. (Read the following paragraph before you flip the switch!).

When you turn the computer on like this it is called a COLD BOOT. When cold booting a computer it performs several internal checks. It first finds out all the different components it has: how much main memory, what type of monitor, how many disk drives, what kind of disk drives, etc. This information is either found on a switch block or in a special type of memory (CMOS). Once this information is made available to the computer it checks each component. Therefore, when you cold boot a system, you can see it checking the different components including the memory. Then it finds certain boot instructions called the boot loader and follows it. Now you will notice the hard disk drive light come on. It is actually reading what is called the Disk Operating System (DOS), which is a supervisor program. We will have a lot more to say about this later.

INTRODUCTION TO MS-DOS

While living in Lubbock our family used a water cooler to keep the house cool. When we felt it was cool enough, we could flip the switch off. Now we live in a house with central air conditioning, which is controlled by a thermostat. The thermostat controls the air conditioner (the thermostat acts like a supervisor). Similarly there was a time that all operations of the computer had to be programmed by setting switches or changing wires. Most of these system operations are now automatically controlled by supervisor programs contained in the OPERATING SYSTEM (OS).

Simple tasks such as receiving input from the keyboard, deciphering meaning of each key pressed, writing information to the screen or locating and reading a file from a disk, all are functions carried out by the OS. MS-DOS is a type of OS used by IBM-PC and compatible machines. PC-DOS is the IBM version of MS-DOS. Examples of other operating systems used on microcomputers are CPM, OS/2, UNIX, and XENIX. Sophisticated operating systems are very large and they are usually broken down into several small programs. If all these programs are loaded into the main memory, it would not leave any memory to run our programs. Therefore, only absolutely necessary instructions are loaded into the main memory, the rest is kept on the disk (auxiliary memory) and is loaded as needed. Commands that are loaded into the main memory are called INTERNAL, and the rest are called EXTERNAL commands.

 

KEYBOARD UNDER DOS

The keyboard you are using is called an extended keyboard, because it has the numerical pad separate from the cursor keys. The alphanumeric keys are almost identical to a typewriter. Notice that you can get the uppercase by holding down the SHIFT while pressing the desired key. You can also use the CAPS-LOCK with one main difference, with CAPS-LOCK on you CAN NOT get the special characters indicated above the top row and the keys on the right. To get these special characters you must press the SHIFT regardless whether the CAPS-LOCK is on or off.

There are two other keys which works similar to the SHIFT in that these keys must also be held down while pressing another one; they are: ALT and CTRL. These key combinations give us flexibility to produce additional characters, or to give special commands to the computer. For example if you hold the ALT key down and press 144 you get É. If you hold the CTRL key down and press i, the cursor moves to the next tab position. Functions of these keys would depend upon the program you are using. An important key combination to remember is CTRL-C (also written as ^C); it will allow you to break out of many programs (BUT NOT ALL!).

You can get numbers either using the top row or the keys in the numerical key pad. If you decide to use the numeric pad, make sure the NUM LOCK is on. If the NUM LOCK is off, these keys work identical to the cursor keys. Cursor keys will allow you to move the cursor (the blinking character which tells the position on the screen) up, down or sideways. CURSER KEYS ONLY WORK WITH SOME PROGRAMS. The PAGE UP and PAGE DOWN keys work like the cursor keys, except it moves the cursor one page (or a screen) at a time.

There are some special keys you must be thoroughly familiar with. The BACKSPACE will erase the character you just typed and move the cursor back so that you can retype that character. The TAB key will allow you to tab right or left. The ESC key has different functions under different programs. Under some programs it will allow you to go back to the previous screen. Most commonly the ESC key allows you to send control characters to the printer and the monitor. Suppose, you want your text to be underlined, you must send an escape character sequence to the printer to begin and end underlining. Fortunately, the user does not have to know these special codes, the programmer takes care of it. However, if you are going to write programs, you may need to know about these.

Another special key is the SCROLL-LOCK. If you told the computer to display something on the screen and the contents is more than a screen full, it will scroll too fast for you to be able to read it. If you press the SCROLL-LOCK it will freeze the screen; touch any key, it will continue to scroll (Control-S has the same effect as the SCROLL-LOCK).

The PRINT SCREEN key will allow you to send whatever you see on the screen to a printer.

There is another set of special purpose keys called FUNCTION KEYS above the regular alphanumeric keys; these are labeled F1, F2, F3....F12. Programmers can assign special meanings to these keys while running a program. For example, while running Word Perfect you will find that the F7 is the key used to exit from what ever you happened to be doing. What is even more interesting is that these keys can be used in combination with the Shift, Ctrl, and Alt keys to give different meanings. Therefore, each function key can have 4 different meanings!

Finally, mathematical operators are +, -, * and / for addition, subtraction, multiplication and division respectively.

DOS VERSION.

Each edition of the DOS is given a version number. Major editions are numbered 1,2,3,4, etc. Minor revisions given decimal numbers. For example, DOS 3.3 means that it has gone through 3 major revisions and 3 minor revisions. Sometimes different versions may not be compatible. For example, if you are working with DOS 3.2 and your friend is working with DOS 3.3, it is possible for a file backed-up with one version can not be restored with the other version.

DISK DRIVES

As we discussed in chapter 1, information can be stored in the main memory or in the auxiliary storage. Disk Drives are auxiliary storage devices. There are two major kinds of disk drives, they are: FLOPPY DISK and HARD DISK drives. Floppy Disk drives use removable diskettes, whereas hard disk drives use non-removable disk packs.

Let us first talk about the floppy disk drives and the diskettes they use. All of us have used a tape recorder. The tape has an iron oxide coating which can be magnetized by the recorder. The magnetic pulses can be detected by the read head; these pulses can be amplified and sent to the speaker. Diskettes also have a flexible plastic core onto which a magnetic substance is coated. Depending on the quality of this coating a diskette may be classified as single density, double density, or high density. The double density diskettes can hold twice as the single density, and the high density diskette can hold four times. On a floppy drive there may be one read/write head or two heads. If it has only one head then it is called single sided, if it has two heads then it is called double sided. There are three different sizes of diskettes: 8", 5.25" and 3.5". Here are the different types of diskettes available for microcomputers:

8" SINGLE DENSITY SINGLE SIDED

5.25" SINGLE DENSITY SINGLE SIDED 90K

5.25" DOUBLE DENSITY SINGLE SIDED 190K

5.25" DOUBLE DENSITY DOUBLE SIDED 360K

5.25" HIGH DENSITY DOUBLE SIDED 1.2 MEG

3.5" DOUBLE DENSITY DOUBLE SIDED 720K

3.5" HIGH DENSITY DOUBLE SIDED 1.4 MEG

Each of these should be matched with the proper drive. Fortunately, the most commonly used diskette is the 360K DS/DD. You will be using these double sided double density diskettes in our lab. Please purchase two; does not matter which brand you buy. The computer you will be using in the lab has two floppy disk drives, A: and B: (notice all device names end with ':'). The A: drive is a 1.2 meg drive (High Density double sided) and the B: drive is a 360 K drive (double density double sided). You will be placing your diskette in drive B: (please keep in mind that Drive A: can read and write the 360K diskettes whereas Drive B: can not read a 1.2 meg diskette).

Confused about Ks and Megs? How is information stored and processed inside the computer? They are stored using binary digits (BITs). Consider each bit as a switch (each switch gives on/off or 0/1 states). These bits are grouped by eight and called a BYTE (eight bits makes up a byte). There are 1024 BYTES in a K-byte. 1024 Ks make up a MEGA-byte.

Let us take a closer look at the diskette you have purchased to be used in this lab. If it has a label with some trademark, place it in front of as if you are reading the label. On the right edge of the diskette you will see a notch. This is called a write protect notch. If you cover this notch with a tape, the disk drive will not write on this diskette; you can only read from it. The diskette you use every day will not have tape over this notch. To the bottom middle part you see a small window (on both sides); this is read/write window. The head moves along this window up and down as the disk rotates. In the middle there is a whole; this is where the drive motor holds the diskette to turn it.

There are certain precautions to keep in mind while handling a diskette. Do not touch the exposed part of the diskette (window). Do not bring a magnet or anything that contains a magnet (such as electric motor, screw drivers, etc.) close to it; it will erase all the information. Do not leave the diskette in your car, it will warp and deform; you can't read it afterwards. When you take the diskette out of the drive immediately place it in the protective envelope. Do not write on the diskette or on a label on the diskette with ballpoint pen; use a felt tip pen.

When there were only just a few different types of computers, the diskette came already formatted. Since there are so many different computers and different disk drives now, it is impossible to send the diskettes already prepared. Therefore, you buy an un-initialized diskette and format it yourself for your particular computer. A program to perform the format is included in the Disk Operating System (DOS) that comes with the computer. If you do not format the diskette, it is unusable; your computer can't read from it on write on it. You only have to format a diskette only once, NEVER AGAIN UNLESS YOU WANT ALL THE INFORMATION ON IT ERASED.

Format places magnetic circles on the disk making tracks on the diskette. The tracks are further divided into sectors. The sector address is written at the beginning of each sector during the format. Format also keeps two special areas for house keeping, one to keep a record of all unused tracks (File Allocation Table -FAT) and one to keep the directory of the files on the disk with associated information. FAT is for internal use only, but the directory can be examined by the user. For any reason the FAT table gets erased or the directory gets erased, the disk will become unusable. There are recovery programs that comes with DOS that can be used or other recovery programs such as Norton Utilities may be used.

Sometimes it is necessary to make a diskette bootable (means you can use this diskette when you first turn the computer on). If you need to make the diskette bootable, there are certain system files that must be written on the diskette. You can do both formatting and transfer system files by issuing a single format command with a switch. Don't panic, keep reading, it will become clear.

Assuming that the program supplied in your DOS diskette called FORMAT.COM is accessible, type:

FORMAT B: /4/S <ENTER>

The command is FORMAT; notice there is a space after the command. After the command you need to indicate which drive you wish to format; in this case drive B: will be formatted. The rest are the switches. A switch is denoted by the slash (forward slash not the backward slash '\'). The first switch '/4' indicates that you are using a DSDD diskette, the second switch '/S' writes the system files needed for booting on to the formatted disk. If you did not need a bootable disk just leave out the last switch. There are several other switches that can be used with the FORMAT program. Refer to DOS manual for additional switches.

Go ahead and format one of the diskettes with the /s option. It will ask you to place a diskette in drive b: and press enter. When finished the program will ask you if you wish to format another one. Answer N for no. Now format the other disk without the /s option. Again answer N, for the question.

 

Here are some error messages and how to correct the problem:

BAD COMMAND OR FILE NAME - DID NOT TYPE THE COMMAND EXACTLY

WITH NECESSARY SPACES. RETYPE.

or

- COMMAND.COM IS NOT ACCESSIBLE.

PLACE DOS DISK IN A: AND TRY

A:FORMAT B: /4/S.

BAD MEDIA OR DISK UNUSABLE - DISKETTE MAY NOT BE DSDD OR

BAD TRACK ZERO. USE ANOTHER.

INVALID PARAMETER - SWITCHES ARE WRONG.

ERROR READING DRIVE B: - DID NOT PUT DISK IN OR DID NOT

CLOSE DRIVE LATCH.

DOS INTERNAL COMMANDS

Earlier in this appendix you were introduced to INTERNAL and EXTERNAL commands of the Disk Operating System. Internal commands are those that are read in to and stored in the main memory when the system is booted. Here they are (only important ones):

CD CLS COPY DATE DEL

DIR ECHO MD PATH PAUSE

PROMPT REN RD TIME TYPE

We will go over each one. You need to be in the system prompt (usually C:\>) when doing this exercise. We will do the easy ones first.

CLS clear the screen. Type cls and press enter and see what happens.

DATE Displays system date and ask you if you wish to change it.

If you decide to change it use 08/09/1991 format; include the zeros and slashes exactly. Try it! Type DATE and press enter.

TIME Displays system time. To change time use format 13:10:01.

DIR Displays existing files in a disk. There are ways to hide a file from displaying to the directory. A hidden file cannot be copied using the copy command. Type DIR A: and press <ENTER>. It will display directory of A: Now replace the disk in A: with the other disk you made. Check directory again. The disk with system files should have a file called COMMAND.COM (and two hidden files) and in the other one should have none.

Names of files can be up to eight characters long. A three character extension is used to identify the type of file. For example, files with extensions .COM, .EXE, and .BAT can be called directly from the DOS prompt. Other file extensions usually used are:

.BAS for basic programs

.PAS for pascal programs

.COB for cobol programs

.TXT for text files (letters etc.)

.DOC same as TXT.

.BAK a backup file.

.WKS A spreadsheet file.

You will see most of these file types during this semester. If you do not understand this part about the extensions, do not be too concerned right now.

COPY Makes a copy of a file. Place the disk with the COMMAND.COM file in disk drive A: You will find that there is a particular order in which DOS commands should be typed in:

COPY A:COMMAND.COM A:MYCOPY.BAK

COPY is the command; there MUST be a space after it. The rest tells COPY from where to where. In this case COPY from A:COMMAND.COM (notice that there are NO SPACES); copy from disk drive A: the file called COMMAND.COM. COPY this to A:MYCOPY.BAK (again NO SPACES); copy to the same disk drive (A:) but give it a different name, MYCOPY.BAK. You could use any name; just remember you can have eight characters in the name then a period and three characters in the extension.

To make sure it was copied, check the directory of A: again. Note that both files are listed here.

COPY command can also be used to copy keystrokes from the keyboard into a file. In this case we are going to copy a file called CON (console) to a file called A:AUTOEXEC.BAT. Once you issue the command everything that appears on the screen after this command until the special character Control-Z (^Z) will be captured and stored in the file AUTOEXEC.BAT in drive A: Type the following:

COPY CON A:AUTOEXEC.BAT <ENTER>

DATE <ENTER>

DIR A: <ENTER>

PAUSE <ENTER>

CLS <ENTER>

ECHO THAT'S ALL FOLKS! <ENTER>

^Z <ENTER>

Remember to keep ctrl key down while pressing Z.

To be sure you created a file called AUTOEXEC.BAT, ask for the directory of A: again. Is it there?

TYPE will print the contents of a file to the screen. In order to print the contents of the file we just created type:

TYPE A:AUTOEXEC.BAT

What if you wanted it to go to the printer? type:

TYPE A:AUTOEXEC.BAT >PRN

With this command you should be able print any file to the printer. But some files are not printable; they do not contain characters, but binary codes. Files that can be generally printed have extensions .BAT, .DOC, or .TXT.

DEL Deletes a file. You should be careful when using this command. Type

DEL A:MYCOPY.BAK and press <ENTER>.

Again notice that there is a space after the command DEL and no spaces between the rest. Check directory of A: again; now MYCOPY.BAK should not be there!

The file you created called the A:AUTOEXEC.BAT contains several of the internal DOS commands. This file is called a batch file. Instead of typing each of the commands in from the key board you can just call the name of the file and the computer will execute each command one after the other. Let us try it, type A:AUTOEXEC <ENTER>. Make sure to enter the date using the right format.

The internal commands that deal with disk drive organization will be discussed in Chapter 5.

DOS COMMANDS RELATED TO DISK USAGE

We have already seen to very useful disk related commands, DIR and FORMAT. In this chapter we will explore, MD, CD, RD, BACKUP and RESTORE commands.

It is possible to build a house but have no rooms (partitions). In such a house you can put any kind of furniture anywhere! It is equally possible to have a disk with no partitions; you can dump all files at the entrance. It does not make any more sense than building a house with no rooms. While it is not necessary to make sub-directories in a floppy disk drive, it is absolutely essential to organize a hard disk drive properly.

When you first boot your system, the computer boots from an area in the disk called the root. Consider the root as the entrance to a house. You should only keep absolutely essential files in this area such as boot files, list of sub-directories, autoexecute files, etc. Sub-directories should be created from the root (these subdirectories are similar to hallways from the entrance). Here is how to create a subdirectory called 'WORDPROC' from the root:

md C:\WORDPROC md stands for make directory.

The back slash (\) instructs to make this directory from the root. Once a subdirectory is created, you can move to that area by issuing the command:

cd C:\WORDPROC cd stands for change directory.

Again, the back slash indicates that subdirectory is from the root. Now it is possible to make additional subdirectories from the WORDPROC area; it is like rooms off of a hallway. Here are two examples:

md LETTERS

md ESSAYS

Notice that no back slash is used here. You can move from the root to letters by issuing the command:

cd \WORDPROC\LETTERS

All major programs used such as word processing, spread sheet, data base, etc. should have subdirectories from the root. From each of these subdirectories additional subdirectories must be created for similar projects.

In order to remove a directory, all files from that subdirectory and other subdirectories from it must be deleted first. Then remove the innermost subdirectory first. For example, remove all files from LETTERS

(del \WORDPROC\LETTERS\*.*), then remove all files from WORDPROC (del \WORDPROC\*.*). Now the subdirectories can be removed:

rd \WORDPROC\LETTERS

rd \WORDPROC

Backup and Restore commands are used for security reasons. Since hard disks are generally non-removable, data and software on them can be lost as a result of accidental erasing, disk drive malfunction, theft, sabotage, etc. Therefore, it is imperative all essential information from the hard disk drive is backed up. Data can be backed up on tape or on floppy disks. Regardless of which is used, there must be a minimum of 3 sets of backup media. If only one set is used, it is possible lose good data. For example, suppose you have a backup from MONDAY. On Tuesday, some thing happened during the day and you lost an important file. At the end of the day you backed up the files from TUESDAY, on top of MONDAY's files. On Wednesday, you discovered the problem. You have the false security that you have a backup! In reality, you have a copy of your problems! If you had a different set of backup for MONDAY and TUESDAY, you could have gone back to MONDAY and restored the missing file. When backing up files on diskettes use the following command to copy all files under the WORDPROC subdirectory:

backup C:\WORDPROC\*.* A: /S

This command will backup all files and subdirectories (swich /S stands for subdirectory) from WORDPROC. The program will ask you to put the first disk in, then the second disk and so on, until the entire copying process is finished.

Restore command only should be used when for some reason some thing happened to the files on hard disk drive and you want to restore the latest good backup you have. In such case all data added since that backup should be entered again. Here is the command to backup WORDPROC.

restore A: C:/S

ASSIGNMENTS FOR CHAPTER 1

1. Format a floppy disk and make it bootable.

2. Copy Command.com to that disk.

3. Make a subdirectory called PROGRAMS.

4. Make an Autoexec.bat file on disk using COPY CON

5. Diskcopy and make a backup of this disk.

6. Explain the purpose of the Autoexec.bat file.