4.2. INTRODUCTION TO DOS

4.2.1. THE BOOT

4.2.1.1. BACKGROUND

Version 1.00 of DOS (Disk Operating System) was released in 1981 for the IBM PC. The policy of maintaining backwards compatibility has been followed in subsequent versions. The system editor included with DOS is "edlin" which is a line-editor. A new full screen editor "edit" has been included in DOS version 5.00. Most word processing packages facilitate screen-oriented editing in a non-document format.

Standard operating system commands that are built into DOS (such as DIR) are referred to as permanent, internal, or resident. Other commands are contained in separate files; these commands are referred to as temporary or external. When using a hard disk system it is good form to store external commands in a directory of their own.

4.2.1.2. BOOTING DOS

Before a computer can be used it must have an operating system loaded into its memory. DOS is resident on the hard disk of the micros (Eazy-PCs) in C115, in addition to several other computers on campus. When the micro is turned on, the boot program in ROM (Read Only Memory) loads up the operating system from the hard disk into memory. This process is called booting.

Cold boot Turn on the micro using the power switch at the left back of the Eazy-PC

Warm boot When the micro is on, press and hold both the[Ctrl] and[Alt] keys, then press the[Del] key. This resets the computer, erases the information from RAM and reloads DOS

When you boot DOS, the monitor displays a prompt asking for the current date and time. You may hit[Return) twice to bypass this option and get directly to the system prompt:

C >

This indicates that the hard drive (which is drive C) is the default drive. All DOS commands will act on this drive unless otherwise specified. DOS commands can be entered at the system prompt and executed by hitting[Return). If a DOS command is typed incorrectly, the monitor will display an error message:

Bad command or file name

This message means that DOS did not understand the command. Check the spelling of the command and enter it again.

The default disk drive can be changed from the hard drive C to the floppy drive A by typing:

A:[RETURN]

at the C> prompt. The default drive will now be A and the system prompt will be:

A>

There must be a disk in floppy drive A.


4.2.1.3. LEAVING DOS

When you wish to turn off the microcomputer, it is necessary to end the session properly and fully. To properly end a session it is necessary to :

*exit all utilities to get to the system prompt,

*remove the disk from drive A,

*turn off the computer.

NOTE: To protect the disk drive heads from damage make sure that the disk is removed from drive A and be sure that the drive light is out before shutting off the Eazy-PC.


4.2.2. FILE SPECIFICATION

Every file must have a unique name and follow the DOS file naming convention to be able to:

* create and name files

* copy files to the same disk or to a different disk

* rename files

* view the contents of files

* remove files

The DOS naming convention is:

filename.extension

* Filenames

The filename consists of 1 to 8 characters which can be letters of the alphabet, certain special characters and the numbers from 1 to 9. In general, punctuation characters or brackets cannot be used in a filename. If you use an illegal character in a filename, you will get the following error displayed:

File creation error

* Extensions

The extension is optional but if used it consists of a period followed by zero to three characters.

Following are some examples of legal file names:

assign2.txt

works.t

assign2

a

a.b

Filenames should be meaningful to reflect the contents of the file. Although they are legal, the last two examples are not good choices for filenames.

Some commonly used extensions are:

BAK backup

BAT batch (file of DOS commands)

COM command file

EXE executable file

INI initialize

SYS system (DOS)


4.2.2.1. COMPLETE FILE SPECIFICATIONS

It is important to specify the drive that the file resides on or the drive on which you wish to have a file written. To specify the drive, the drive letter and a colon must precede the filename. For example, a "C" must precede files that are resident on the working directory of the hard disk and an "A:" must precede those files in the working directory of the floppy disk on drive A. Always use complete file specifications. Some examples:

a:info.txt the file info.txt on the floppy disk

c:info.txt the file info.txt on the hard disk


4.2.2.2. WILDCARD SYMBOLS

Wildcard symbols take their name from the wildcards in card games that can be substituted for any other card. There are two wildcard symbols:

? represents any one character in a file name

* represents all characters in a filename or part of a filename

Some examples of using wildcards follow:

*.* all files with all extensions

*.bat all files with the .bat extension

assign.* all files with the filename assign with any extension

*.? all files with a one character extension

works?.doc all files of 5 or 6 characters starting with works and having the .doc extension


4.2.3. CONTROL SEQUENCES

DOS has several control sequences (a combination of keys pressed simultaneously) that perform special functions:

[[CTRL] s] freezes the screen, typing any key causes display to resume.

[[SHIFT)[PrtSc]] dumps the current screen contents to the printer.

[[CTRL][PrtSc]] toggles continuous dump to the screen.

[[CTRL] z] is used to indicate end of file.

[[CTRL] c] is the customary 'kill' sequence.

4.2.4. DOS COMMANDS

4.2.4.1. FORMAT

Before a floppy disk can be used by a microcomputer, it must be formatted. This step makes a disk readable and writeable by DOS by breaking the disk into addressable sectors that are used as organizers for storing files. Formatting a disk involves the following operations:

* At the C> prompt type:

FORMAT [RETURN]

DOS then prompts:

Drive to format ?

* Respond by typing:

A[RETURN]

DOS prompts with:

Insert new disk in drive A

and press RETURN when ready

* Insert a new disk in drive A and press[RETURN]

DOS displays the following message as it starts to format your disk:

Head:0 Cylinder:1

and proceeds to count to cylinder 79

DOS displays a message when formatting is complete;

Formatting complete

Do you want to format another disk (Y/N)?

* Press[RETURN] for No. DOS displays the system prompt C>

4.2.4.2. DIR

Lists the files in a directory. If no directory path is specified, the contents of the working directory of the default disk are displayed. The prompt indicates the default disk; if it is C>, then the hard disk is the default disk, if it is A> then the floppy disk is the default disk. For example:

dir[RETURN] lists the working directory of the default drive

dir a: [RETURN] lists the working directory of drive A

dir c: [RETURN] lists the working directory of drive C

4.2.4.3. DEL

Del removes the specified file(s) from the default disk's working directory. Some examples:

del a:info.txt [RETURN] deletes info.txt from the working directory of drive A

del c:temp.bas [RETURN] deletes temp.bas from the working directory of drive C

Note that these examples are complete file specifications consisting of the drive letter, a colon, then the filename and extension.

4.2.4.4. COPY

This command is used to copy a file(s) to another specified file on the same device or a different device. Examples:

copy works.inf works3.inf [RETURN]

Copies the file named works.inf to another file called works3.inf in the same directory and the same drive as works.inf. Two file exist in the same directory.

copy a:info.txt c:info.txt [RETURN]

Copies the file named info.txt from the floppy disk to the hard disk so that the file exists on both disks.

4.2.4.5. RENAME

This command is used to change the name of a file(s). Examples:

rename works.inf works3.inf [RETURN]

Changes the file named works.inf to another file called works3.inf in the same directory of the default drive. One file exists.

rename a:info.txt cover.txt [RETURN]

Changes the file named info.txt to another file called cover.txt in the same directory of the floppy drive. One file exists.


4.2.4.6. TYPE

The type command displays the contents of a text file to the screen.[[Ctrl] S) and[[Ctrl] Q) can be used to temporarily stop the scrolling of the file text on the screen and restart the scroll again, respectively. For example:

type works.txt [RETURN] Displays the contents of the file works.txt to the screen.

type a:works.txt [RETURN] Displays the contents of the file works.txt that is resident on the floppy disk to the screen.


4.2.4.7. DISKCOPY

This command copies the contents of one disk to another disk. When you enter the command with no other parameters (i.e. just the command diskcopy), you will be prompted for the source and the target drives. The source is the disk you wish to copy from and the target is the disk you wish to copy to. If the target disk needs to be formatted, then diskcopy will do this. In all cases diskcopy writes over any information that may be on the target disk. For example:

Diskcopy a: a: [RETURN]


4.2.4.8. CHKDSK

This command checks the specified or default disk and displays a disk and RAM status report. For example the command:

Chkdsk A: [RETURN]

displays the following report:

730112 bytes total disk space

39936 bytes in user files

690176 bytes available on disk

655360 bytes total memory

594384 bytes free


4.2.5. ADVANCED DOS


4.2.5.1. DEVICES

CON is the console device. The following is a simple method of creating a file from console input.

C> copy con a: fn.TXT

-

- (enter any number of lines)

-

[[CTRL] z] (terminate by typing[[CTRL] z] ]

PRN is the printer device. There can be up to 3 parallel printers - LPT1, LPT2, LPT3. Device name PRN is synonymous with LPT1.

AUX is the communications ports. There can be 2 ports - COM1, COM2.

Device name AUX is synonymous with COM1.

DOS Version 3.3 and higher also supports COM3 and COM4.

4.2.5.2. FILES NECESSARY FOR DOS

COMMAND.COM - the DOS command interpreter

CONFIG.SYS - contains configuration information

AUTOEXEC.BAT - contains the startup procedure

DOS expects to find these files in the root directory.

4.2.5.3. REDIRECTION OF I/O

The "<" and ">" symbols can be used to redirect standard I/O.

e.g. type filename1.filetype > filename2.filetype

causes the output of the 'type' command to go to filename2.filetype rather than the screen.

e.g. sort < filename.filetype

indicates that input is to come from filename.filetype rather than the keyboard.

The "|" (pipe) can be used to take the output of one command and use it as the input for the next command.

e.g. type filename.filetype | more

4.2.5.4. DOS DIRECTORIES

DOS supports a tree-like directory structure. A path can contain several subdirectories; separate each with the "\" (backslash) character. The following commands are used to manipulate directories.

md path creates a directory

cd displays name of the current directory

cd path changes to the directory specified

cd .. moves backward one level to the parent directory

cd \ changes to the root directory

rd path removes a directory; this will abort if there are files in the

directory

chkdsk /v displays all files and directories in the current drive

4.2.5.5. CURRENT PATH

When a command is entered, DOS looks for it in the current directory. To instruct DOS to look elsewhere, use the "path" command. A series of paths can be defined by one command; separate each path with a semicolon.

e.g. PATH C:\ tells DOS to look in the root directory.

e.g. PATH C:\ ; C:\DOS tells DOS to look in the root directory or in the \DOS directory.

Place the path command in the AUTOEXEC.BAT file if a path is referred to frequently.

Note: use "append" rather than "path" to instruct DOS where to look for data files.

4.2.5.6. COMMAND FILES

An entry at the prompt is assumed to be a command. DOS searches for this in the following order:

1. in the DOS commands

2. for a filename with a COM or EXE extension

3. for a filename with a BAT extension

Command files, also referred to as "batch files" must have a BAT extension. This type of file can contain:

commands - including the names of other batch files

display statements - syntax: rem string

replaceable parameters - syntax: %n where 0 < n < 9

(the actual parameter is entered on the command line)

control statements.

Enter the name of a command file to begin execution of the file and type[[CTRL][BREAK)) to cancel execution. Note that when the name of a command file is encountered within the command file currently being executed, control passes to the named file and then back to the system.

The following is a summary of control statements.

echo on causes command names to be typed as they are executed

echo off turns echo off; note that the rem statement is not printed when echo off is toggled

echo message displays the message indicated

pause string displays the string and then "strike any key when ready" and then waits for user entry.

pause displays "strike any key when ready" and waits for user entry

if [not] condition command

executes the command if the condition is true

"condition" can be:

exist filename - DOS looks to see if the file exists

strings 1 == string 2 - DOS checks for equality

"command" can be any command including "goto"

label syntax: :label

shift moves parameter list to the left by one

e.g. :begin

if %1 =="" goto end

type %1

shift

goto begin

:end

for %%p in (list) do command

values in 'list' are separated by spaces

%%p takes on each value in 'list'

'list' could be one replaceable parameter and the parameter entered in the command line could contain a wildcard specification

call batch-filename parameter_list

control reverts to the line following the call after the called file is executed.

4.2.5.7. SOME USEFUL DOS COMMANDS

attrib [setting(s)] file change attributes of a file

+r turn on read-only attribute

-r turn off read-only attribute

+a turn on archive attribute

-a turn off archive attribute

(the archive attribute is turned on if the file was changed since the last backup)

Use the /s option to apply the command to subdirectories.

attrib file shows current attribute settings

chkdsk drive: checks a disk (indicates files, bad blocks, etc.)

compare file1 file2 compares two files

copy file1 file2 copies a file

delete file deletes a file (same as erase)

dir lists files - a path or drive can be specified e.g. dir a:

diskcopy drive: drive: duplicates a disk (destination can be unformatted)

erase file deletes a file (same as delete)

format drive: [option(s)] initializes a disk; the Packard Bell computers have high density disk drives - refer to the Users Guide in the Consulting area for details on how to format a double density disk on a high density drive

/s create a bootable disk

/v allows you to enter a label for the disk

(label can be 1 to 11 characters)

label drive:new-label changes the label on the disk

command | more useful for typing (see the type command) large files, display pauses when the screen is full; type any key to continue

e.g. dir | more

e.g. type file | more

print file prints file(s) to the printer

rename file1 file2 renames a file

sort sorts using standard input and output.

Use redirection to specify files

e.g. sort <infile >outfile

type file displays contents of file(s)

ver responds with version number of DOS on disk

4.2.5.8. VIRUS PROTECTION

Viruses are programs that are designed to modify the behavior of a system in an unexpected manner. Some viruses are extremely dangerous, causing the deletion of files or the formatting of your hard disk.

The Computing Services Department has purchased a site license for FPROT, a virus protection program that allows you to check your disks for known viruses and to disinfect your disks. If you wish to obtain a copy of FPROT, take a formatted floppy disk to Computing Services and ask for a copy of FPROT. Documentation is included with the software.