DOS

What do you get when you buy DOS?

Handles interrupts (Ctrl-Break)
Handles errors (Drive not ready)
Displays ready prompt (C:\>)
Looks for AUTOEXEC.BAT file
Looks for CONFIG.SYS file
Executes .EXE, .BAT, and .COM files

Internal Commands - files containing programs that are automatically copied to RAM when the computer is turned on. Sometimes referred to as resident commands.

COPY
DIR
ERASE
DATE
TYPE
RENAME
TIME
VER

External Commands - files containing programs that the user must first copy into ran before using. Why not put all DOS programs in RAM?

FORMAT.COM
CHKDSK.COM
DISKCOPY.COM

BASIC interpreter stored in BASICA.COM or QBASIC.EXE
Editor to edit DOS files. Old versions stored in EDLIN.COM, new versions stored in EDIT.COM

There are about 100 other DOS programs stored in files. Thankfully, you won't need many of these.

KEYB.COM MODE.COM SYS.COM MIRROR.COM LOADFIX.COM ASSIGN.COM After DOS loads the resident commands, it looks for two files:

CONFIG.SYS

Contains instructions that DOS needs to work with your computer and its memory, your devices, and your programs.

The commands in CONFIG.SYS relate in one way or another to your hardware.

If you add a device to your set up, there's a good chance you will have to update CONFIG.SYS.

Buffers=15
Files=20

Buffers: When DOS reads from a disk or prepares to write to a disk, it moves the information in groups of bytes rather than one at a time. As it collects this information, DOS stores it temporarily in specially reserved portions of memory called buffers. The buffer command allows you to tell DOS the number of buffers you need.

Files: The Files command tells DOS how many files may be open at one time.

Note: You will probably never have to alter this file unless you accidently erase it.

AUTOEXEC.BAT

No PC literacy class is complete without understanding the AUTOEXEC.BAT file.

AUTOEXEC.BAT is an example of a batch file.

A batch file contains a set of commands that DOS can carry out as a sequence instead of stopping after each command and waiting for you to type the next one, as it would normally do.

This file contains a set of commands that you would want issued every time the computer is turned on. For example, you may want to automatically run a virus detection program, exit the program, the change to a new path.

The following AUTOEXEC.BAT file contains commands to automatically execute a virus scanner program.

C:\VIRUS\VSAFE /1+/2 /3 /4+/5+/6+/7 /8+ C:\VIRUS\CPAV.EXE /C C:\VIRUS\BOOTSAFE

DOS Prompt

When DOS has loaded resident commands into RAM, checked the CONFIG.SYS and AUTOEXEC.BAT files, it is now ready for the user to issue a command. The user knows that DOS is ready when DOS presents a prompt to the user. The prompt typically points to the hard drive:

C:\>

This prompt means that the active drive is the C drive. When you issue a command to DOS, it will look for the necessary data or programs on the C drive.

If the computer is on a network, the prompt may point to a network drive:

N:\>

The prompts can be changed to point to either the A or B drive.

C:\>A:
A:\>

When would you want to change the prompt to the A drive or B drive?

FORMAT Command

The FORMAT command is used to create the file allocation table on a floppy disk.

The FORMAT command is used on new disks.

Note: If you issue a format command on a disk that already has data on it, you will lose that data.

If you want to format a floppy disk, place it in either the A or B drive. Then issue the command:

C:\>FORMAT A:

or

C:\>FORMAT B:

DOS will respond with the following message:

Insert new diskette for drive A:
and press ENTER when ready...

After you hit enter, DOS displays a series of messages. When the format is complete, DOS may ask you to enter a volume label:

Volume label (11 characters, ENTER for none?)

A Volume label appears when DOS reports on a disk's contents. A volume label is optional. Most users elect to just hit ENTER.

Then DOS will report the total disk space, the bytes available for use, and whether any portion of the disk is damaged.

DOS will then ask you:

Format another (Y/N)?

Answer accordingly.

The FORMAT command has many options. See a DOS manual for special options.

DIR

The directory command will list the contents of the file allocation table. To issue a directory command, simply type DIR and the disk drive.

To see the contents of a disk in drive A, type:

C:\>Dir A:

To see the contents of the C: drive, type:

C:\>Dir

What will the following commands do?

A:\>Dir

C:\>Dir B:

B:\>Dir B:

? The Wildcards *

As files accumulate on disk, you can forget exactly how you spelled a file name. Sometimes you'll also want to copy, delete, or otherwise work with a group of related files. To help on both counts, DOS uses ? and *

Question mark ?

Asterisk *

Suppose the directory below has the following files:

MEMO1.DOC
MEMO13.DOC
MEMO11.DOC
MEMO2.DOC
MEMO10.DOC
MEMO15.

What would the following commands yield?

Dir Memo??.doc
Dir Memo*.*
Creating Directories

Because hard disks (and even floppy disks) can get rather crowed, DOS allows you to create directories. Directories simply allow you to organize your files. By keeping all the files of a similar type in one directory, it is easier to find a specific file.

All directories start from the root directory and branch into lower levels.

For example, my harddrive has the following directories:

C:\> Root Directory

C:\WP51> Stores my WordPerfect application programs and some of my documents

C:\dbase> Stores my dBase application programs, my databases, and database reports

C:\VIRUS> Contains my virus scanner programs

In addition, I further divided my WordPerfect directory into:

C:\WP51\DISSER>
C:\WP51\MIS103>
C:\WP51\MIS485>

These directories are organized hierarchically:

Directory Management Commands

MD Make Directory

Allows you to create another subdirectory or path

Suppose you only started out with a hard drive and wanted to replicate my directories.

Here are the commands:

C:\>md wp51

C:\>md dbase

C:\>md virus

C:\>md \wp51\disser

C:\>md \wp51\mis103

C:\>md \wp51\mis485

CD Change Director

To point to a new directory, issue the cd command:

C:\>cd wp51

DOS will return with:

C:\wp51>

To return to a directory higher in the tree, type cd..

C:\wp51\cd..

DOS will return with C:\>

RD Remove Directory

To remove a directory, you must first remove all the files in that directory.

To remove the disser directory, first activate directory

C:\>cd \wp51\disser

DOS will return:

C:\WP51\DISSER>

Erase all files:

C:\WP51\DISSER>erase *.*

DOS will ask you if you are sure. Respond affirmatively. Then go to the parent directory:

C:\WP51\DISSER>cd..

DOS will respond

C:\WP51>

Type the RM command and directory you wish to be deleted.

C:\WP51>rd disser

COPY

The COPY command is used to copy one file into another file.
You may want to use a copy to:

Create a copy of a file, with a new name, to the same storage device
Copy a file with the same name to another storage device
Copy a file, with a new name, to another storage device

Copy source destination

C:\>Copy C:Granny.Doc A:

C:\>Copy A:Granny C:

C:\>Copy A:Granny

C:\>Copy Granny A:

C:\>Copy Granny

A:\>Copy Granny C:

Copy with a wildcard:

C:\>Copy Memo*.* A:

C:\>Copy Memo??.doc B:

Advanced copy commands, see DOS manual

Copy to combine files
Copy to/from a device
Copy from multiple sources

DISKCOPY

When you work with floppy disks, it's often convenient to make an exact duplicate of a disk.

Because DISKCOPY makes a character-by-character duplicate, it works only with disks of the same size and capacity.

DISKCOPY source: destination:

Copy disk in drive A to the disk in drive B:

C:\>diskcopy a: b:

Copy disk in drive B to the disk in Drive A:

A:\>diskcopy b: Use same drive to copy disk:

C:\>diskcopy a: a:

A:\>diskcopy

CHKDSK

The check disk command allows you to check on both the condition of a disk and the amounts of total and available storage on it. Check disk also tells you the amount of memory in your computer and the amount you currently have available for running applications.

CHKDSK source:

C:\>Chkdsk

33462272 bytes total disk space
143360 bytes in 7 hidden files
73728 bytes in 29 directories
28579840 bytes in 931 user files
4612096 bytes available on disk
10240 bytes in bad sectors
2048 bytes in each allocation unit
16339 total allocation units on disk
2252 available allocation units on disk.

In the unlikely event you get a message "X lost allocation units in y chains", consult a DOS manual to re-chain the allocation units into 1 file.

OTHER DOS COMMANDS

DISKCOMP disk1: disk2:
Compares 2 diskettes to make sure they are identical.
RENAME drive: name1 name2
Allows you to rename a file
TYPE drive:name
Displays the contents of a file, as long as the file is in ASCII format.
DELETE drive:name
Delete record of file from FAT.
XCOPY source: destination:
Copy both files and directories
MIRROR drive:
Creates a supplement to the FAT that may be helpful if you accidently format a disk that had data on it.
UNFORMAT drive:
Uses the MIRROR.FIL file created with the mirror command to reconstruct the data on disk.