Introduction to DOS

By Jay Schwartz

Introduction
An operating system is a program that sits directly above the computer hardware and provides an interface for both the user and for other programs to make the computer do things.

In the case of DOS the system is fairly simple.

MS-DOS from Microsoft and IBM-DOS (also called PC-DOS) from IBM is really the same program sold by both companies. Beginning at version 1.0 in 1981, it is now up to version 7.0. Generally you can expect to see versions currently in use from version 3.1 and higher. For our purposes, all DOS versions can be considered the same.

Command Use
DOS uses a command line interface. At the "DOS prompt", the user types a command followed by the ENTER key. Upon seeing ENTER, DOS analyses the command and tries to complete the request. Each command consists of at least the main command word and may be followed by one or more parameters (additional information) separated by spaces. Usually the command tells DOS what to do and the parameters tell it which files to act upon. All DOS commands are case insensitive. Upper and lower can be mixed in any way without affecting the meaning of the command.

DOS consists of both a resident and non-resident part. The resident part is always in the computer and looks after simple input and output and can understand and execute many of the common commands. The non-resident part consists of several standard programs. When a command is not recognized as an internal command, the disk is searched for a program whose name matches the command, and if found, is read into memory and executed. Invoking a non-resident DOS command (such as diskcopy) is therefore exactly the same as running a program (such as WordPerfect).

Disks
DOS stands for Disk Operating System. Therefore, every DOS system has at least one disk (storage device). When power is applied to the computer, a small program which is always in memory begins running. This program tests the equipment and then tries to locate a DOS system disk. If found the system is automatically loaded into memory. The system disk is also called the "BOOT" disk. All disks are referenced by a single letter followed by a colon. Floppy disks (also called flexible disks) are slow low capacity devices but are removable. The letters A: and B: are reserved for floppy disk drives. Note that the letter refers to the drive regardless of what disk happens to be in place at the time. Hard disks are faster and larger capacity but are not removable. The first letter devoted to hard disk use is C:. If a computer has more than one hard disk the second is called D: and so on. These days nearly all DOS systems have at least one hard disk and therefore you can count on a letter C: being available.

Other disk-like devices also get letters. For example, a CD-ROM may be assigned the next drive letter after hard disks and can often be D: however you cannot count on letters after C: being assigned on one computer to be the same as on some other computer. Also, it the computer is on a network, the drives on the network are each assigned letters. Usually beginning from F:. Although the disk is not physically on the DOS computer, the computer acts as if it were local.

Files
Each character of information is called a byte. Bytes of information are gathered together into logical groupings called files. Files can have any number of bytes but generally the file represents a physical item. One file can be a program, a document, a picture, or a payroll.

Each file has a name. The names can have a maximum of 11 characters in total. Furthermore, the name has two parts: the base is up to 8 characters. Then there is an optional period and up to three more characters called the extension. As with commands, file names are case insensitive, and in fact get converted to upper case. Although a user can choose any name for a file, certain conventions are used with regard to extensions. EXE, COM, and BAT are reserved for executable programs. Various programs use certain extensions for convenience such as TXT for text, DOC for documents, BAK for secondary back up files and so on.

When naming files all letters and digits are useable as are some punctuation characters. Some characters have special meaning and cannot be used. Colon and period(.) have already been mentioned as special. Also space is not allowed since it is used to separate parameters. Other unacceptable characters are question mark(?), back-slash(\), asterisk(*), greater than(>) and less than( <). As a general rule, stick to letters and digits when naming files and you cannot go wrong.

Directories In order to organize the files on a disk, DOS creates a directory. That is an index of all files stored on itself. The directory contains the file name, size (in bytes) and the date and time thefile was last modified. Other information is also in the directory such as where on the disk thefile resides and other file "attributes".

In fact, a disk can have multiple directories. The main initial directory on every disk is called the root directory. In the root directory there may be files and also other directories, called subdirectories. These subdirectories may be considered to be variable sized sections of the disk which can contain additional files and perhaps additional subdirectories. The directory structure is usually called a tree because it begins from a single root and branches outward from there to any width or depth.

Understanding and navigating the directory structure of a DOS disk is the main hurdle to working with DOS.

Commands & Programs

 * Wild card parameters

Many DOS commands take one or two parameters which are names of files. It is possible to specify multiple files with similar names in a single command by using wild card characters in the file names. These special characters are ? and *.

The question mark matches any character. therefore, the parameter "AB?CD" will match files ABACD, ABBCD, etc. but not ABBCE.

The asterisk is similar but matches all remaining characters in the name (or in the extension). So

"AB*" matches AB, ABAA, AB123456, etc. AB.1* matches AB.111, AB.123, but not ABC.123.

The ultimate wild card parameter is *.* which matches all files.

Let's now examine some of the common DOS commands.


 * DIR : DIR stands for "directory" and is used to request a directory listing for a given disk. Typing DIR A: will list files on the A: disk (the first floppy). DIR A:ABC*.* will list all files on A: which begin with ABC and have any additional letters and any extension. Similarly, DIR A:*.WP will list all files with the extension of WP.

provided it is given a new name.
 * COPY : COPY will duplicate an entire file on another disk or directory or even on the same directory

The command is COPY [from] [to], and can be used in ways such as:

COPY AFILE.TXT MYFILE.TXT

copies the file on the same disk and directory and gives it a different name.

COPY A:PROG.EXE C:

copies the file from A: to C: keeping the same name.

Remember wild cards can be used.

COPY A:*.EXE

copies all files with the EXE extension (programs) from diskette to the current directory.


 * DEL : DEL (and also ERASE) is used to remove a file or files from disk. Be careful when deleting.

DEL A:\*.*

erases all files on the root of drive A:


 * CD : CD (and also CHDIR) is used to change the current directory. once changed, all unspecified commands and files will be assumed to be in the new current directory. Usage is CD \DOS to change to directory \DOS. If used with no parameter, CD will not change the current directory but rather display the directory currently in use. DOS systems with hard drives almost always have the DOS command programs in a directory called \DOS.


 * MD : MD (or MKDIR) is used to make or create a directory. For example MD \UTILITY will create a directory called UTILITY directly from the root directory.


 * RD : RD (or RMDIR) is used to remove or delete a directory. However the directory must be empty. (have no files or subdirectories). An example might be RD \UTILITY.

Navigating Directories
At any given time the command processor is in some "current" directory. This directory name is usually shown in the prompt. All commands which do not specify a directory use files which are in the current directory. You may change to another directory using the CD command, or you may ask for files in another directory by giving a full path name for the file. That is, the disk, all directories and finally the file name. This called the absolute path. An example is

COPY C:\DOS\INSTALL\README.DOC A:\

A relative path is one which is based from the current directory. If, for example the current directory is C:\DOS then the above COPY command could be written

COPY INSTALL\README.DOC A:\

Since the path does not begin with a drive letter nor with a backslash(\) the path is relative to the current directory.

In this case we are copying to the root directory of drive A:.

Just as there is a current directory, we are also in a current disk. To change to another disk type the letter followed by a colon and press ENTER. You will be returned to the directory you last used on that disk.

Batch Files
A batch file is a text file containing a series of DOS commands which can be executed in a group. The batch file name always has an extension of BAT. You can create or edit any batch file using a text editor. One special batch file is called AUTOEXEC.BAT and is located in the root directory. AUTOEXEC.BAT may or may not exist on a given system but if it does exist, it will be executed immediately after DOS is started. It can be used to set system-wide values or to automatically put the user into a menu system or graphical user interface.

Final Notes
This document is just an overview of DOS. It does not contain the complete set of commands nor features. However, it should be sufficient to allow a novice to boot (start up) a DOS system and browse around. There are numerous books available which can supplement the information in this document.

Other operating systems uses the same type of directory and file structure. These include Windows, OS/2, and Unix. In fact, OS/2 and Windows use nearly all the same commands as DOS (plus a few additional).

Revised: 2001 Feb 18