Batch Files

A batch file contains a series of commands that DOS executes

sequentially whenever you enter the name of the batch file and

press Enter at the DOS prompt. The batch file name must contain

the extension .BAT to execute. However, when running a batch

file, you do not enter the .BAT extension as part of the command

file name.

The batch file is saved as a DOS text file (in ASCII

format). It can contain DOS commands and/or special batch file

commands that are used only in batch files.

Batch files are frequently used to automate the execution of

a group of commands that you find yourself having to enter

manually over and over. These can include typical start-up,

maintenance, and backup procedures as well as such simple tasks

as renaming specific DOS commands to make them easier to remember

and access (such as FORMAT A: to PREPARE).

Each command statement in the batch file is listed by line

in the file, and DOS executes each statement in the order in

which it is entered in the batch file. DOS will terminate the

batch file as soon as it has executed the last command statement

in the file. To terminate a batch file at any time before this,

issue the BREAK command (either by pressing Ctrl-C or Ctrl-

Break). When you issue the BREAK command during the execution of

a batch file, DOS displays the message

Terminate batch job (Y/N)?

To have DOS to ignore the current command statement and

execute the next command statement, thereby continuing the

running of the rest of the batch file, type N. To terminate the

execution of the current and all remaining command statements

(that is, abort the batch file), type Y. (Note that some versions

of DOS require that you press Enter after typing Y or N. Also,

some commands that can be entered in a batch file will not

respond to the BREAK command.)

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

[For related topics, press R]

SEE ALSO

AUTOEXEC.BAT File

Chaining of Batch Files

COMMAND Command

Conditional Processing

Creation of Batch Files

DATE Command

Displaying of Text with Batch Files

ECHO batch file command

Loops in Batch Files

PRINT Command

Replaceable Parameters in Batch Files

Subroutines for Batch Files

Creation of Batch Files

You can create a batch file using the COPY command, EDLIN

(the line editor supplied with DOS), or any other editor or word

processor that can save its text in ASCII format. When creating

or saving the batch file, be sure to append the extension .BAT to

the file name you assign to it.

To create a batch file using the COPY command, use

the paradigm

COPY CON filename.BAT

where

filename Specifies the name you wish to assign to the

batch file.

After entering this, you simply type in each command

statement in the order you wish it to be processed when the batch

file is executed. After typing in each command statement, you

terminate the line by pressing the Enter key.

Once you have entered all of the command statements you wish

to have in your batch file, you save it on disk (in the current

directory) by pressing Ctrl-Z (you can also accomplish this by

pressing F6 on IBM PCs and most compatibles) and the Enter key.

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

[For related topics, press R]

SEE ALSO

Batch Files

AUTOEXEC.BAT File

Displaying of Text with Batch Files

ECHO batch file command

Replaceable Parameters in Batch Files

Loops in Batch Files

Conditional Processing

Chaining of Batch Files

Subroutines for Batch Files

A)AUTOEXEC.BAT File

You can create a special batch file, named AUTOEXEC.BAT,

which contains all of the DOS commands that you wish to have

invoked every time you start your computer. The command

statements in the AUTOEXEC.BAT file often include such DOS

commands as DATE, TIME, PROMPT, PATH, and SET. These can also

include commands that execute special RAM-resident programs such

as Lightning or SideKick or a menu program of your own design.

Such a program would allow you to start up specific application

programs available on your PC- -dBASE III PLUS, Lotus 1-2-3, or

WordPerfect, for example.

Every time you start your computer, DOS checks for the

presence of the AUTOEXEC.BAT file on either the disk in drive A

if you are using a two-floppy disk system, or in the root

directory of drive C if you are using a hard disk system. If DOS

locates such a file, it automatically executes the statements it

contains upon completion of the boot sequence.

When you create the AUTOEXEC.BAT file, remember to include

the DATE and TIME commands along with the other commands you wish

executed each time you start the computer. (If your computer is

equipped with a clock/calendar card, enter the appropriate

commands to have the date and time read.) If you do not add

these commands, DOS will no longer prompt you for the current

date and time as part of the start-up procedure and, as a result,

the files you create with your application programs will not be

stamped with the correct date and time.

Consider the following example created with the COPY command

and containing a sampling of DOS commands typically used in the

AUTOEXEC.BAT file:

COPY CON AUTOEXEC.BAT

DATE

TIME

PROMPT $p$g

PATH = C:\;C:\DOS;C:\BATCH

(Ctrl-Z)

After creating this AUTOEXEC.BAT file, when you start your

computer DOS will first prompt you to update the date and time.

Once you have responded to these commands, DOS changes the prompt

so that it always displays the current directory, and then sets

the path so that it will check the root, \DOS, and \BAT

directories for any command that you enter, regardless of which

directory you are in at the time.

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

[For related topics, press R]

SEE ALSO

Batch Files

Creation of Batch Files

Displaying of Text with Batch Files

ECHO batch file command

Replaceable Parameters in Batch Files

Loops in Batch Files

Conditional Processing

Chaining of Batch Files

Subroutines for Batch Files

PATH Command

PRINT Command

SET Command

A)Displaying of Text with Batch Files

The batch files that you create can contain messages that

are displayed to alert the user to the underlying purpose of the

batch file or to prompt the user to take a particular step- -such

as changing data disks- -during a pause in the execution of a

command. You can also add messages that are displayed as part of

the ECHO command, which controls whether the command statements

entered in the batch file are displayed to the user as they are

executed by DOS.

REM Command

One way to have text displayed on the screen during the

execution of a batch command is with the use of the REM (remark)

command

REM remark

where

remark Specifies the comment to be added to a

batch file.

DOS will not try to execute a REM command, although it will

display REM and the text that follows it on the screen unless it

has previously executed an ECHO OFF statement (see Using the ECHO

Command, which follows).

You can use the REM command to add messages to the batch

file that help make clear its function and procedure. If you wish

to add a nonprinting comment whose purpose is to document the use

of particular commands in your batch file but that is never to be

displayed on the screen to the user, you simply preface the text

of this type of comment with a colon, as in:

:Start backup

Comments prefaced with a colon will appear when you use the TYPE

command to display the contents of the batch file on your screen,

or when you use the COPY or PRINT command to obtain a printout.

PAUSE

You can also have messages displayed on the screen during a

pause in the execution of batch file commands. The syntax for the

PAUSE command is

PAUSE [message]

where

[message] Specifies the message you want to have

displayed on the screen when PAUSE is

invoked.

When DOS encounters a PAUSE statement, it pauses the

execution of the commands in the batch file and displays your

message on the screen, followed by its own message

Strike a key when ready. . .

on the line below. If you enter the PAUSE command without any

message text, you will see only this DOS message instructing you

to strike a key to continue the execution of the batch file.

When you use the PAUSE command, the word PAUSE is always

displayed on the screen along with the message you have entered

(just as when using the REM command). If the batch file has

executed an ECHO OFF command before it encounters your PAUSE

command, neither the word PAUSE nor the text of your message will

be displayed on the screen. Only the DOS message about striking a

key to continue will be visible (see Using the ECHO batch file command,

which follows).

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

[For related topics, press R]

SEE ALSO

Batch Files

Creation of Batch Files

AUTOEXEC.BAT File

Displaying of Text with Batch Files

ECHO batch file command

Replaceable Parameters in Batch Files

Loops in Batch Files

Conditional Processing

Chaining of Batch Files

Subroutines for Batch Files

PRINT Command

TYPE Command

A)ECHO

When DOS executes the commands in a batch file, it can

display each command statement on the screen as it is executed.

You can enter the ECHO command in the batch file to control

whether the command statements are displayed. The syntax is

ECHO [OFF]

or

ECHO [ON]

where

OFF Suppresses the display of command

statements during the execution.

ON Used if you wish to have subsequent

commands displayed on the screen during

the execution of the batch file.

Note that if you enter the ECHO command in a batch file (or

at the DOS prompt) without using either the ON or OFF parameters,

DOS responds by displaying the current state of the ECHO command.

You will see either ECHO is on or ECHO is off.

If you are using DOS 3.3, you can also suppress the display

of a command statement in the batch file by prefacing it with the

@ symbol. For example, entering

@VERIFY ON

will prevent the VERIFY ON command from being displayed. However,

each command statement that you wish to suppress must be prefaced

by an @ symbol. If you use @ECHO OFF, the ECHO OFF command as

well as all subsequent statements are automatically suppressed

until an ECHO ON command occurs.

When ECHO is off, only the display of the command statements

in the batch file will be suppressed. DOS will continue to

display any message that is normally shown after a particular

commandhas been processed. For instance, if your batch file

contains the statement

ECHO OFF

followed by a command to copy a particular file from one

directory to another, you will still see the DOS message

1 File(s) copied

although you will not see the contents of the COPY command itself

on the line above it. Note that you can often get rid of these

messages by redirecting output to NUL:

COPY *.* A: NUL

You can use the ECHO command to display messages to the

user. First, set ECHO to off. Then, enter an ECHO command

followed by at least one space and the text of your message. When

you use the ECHO command in this way, only your message is

displayed onthe screen. DOS does not include the command word

(ECHO) as it does when displaying messages with the REM or PAUSE

commands.

For example, you could have your batch file display a prompt

to insert a data disk in drive A by using the ECHO and PAUSE

commands as follows:

ECHO OFF

.

.

.

ECHO Insert data disk in drive A

PAUSE

When the batch file executes these last two commands, you see

only

Insert data disk in drive A

Strike a key when ready. . .

on the screen. ECHO does not appear along with the prompt

message, but the separate PAUSE command causes the Strike a key

when ready. . . message to be displayed.

When you use the ECHO command to display messages and

prompts, be sure that it is preceded by an ECHO OFF statement (or

an @ symbol if you are using DOS 3.3) in the batch file.

Otherwise, you will see the ECHO command statement containing the

message as well as the message itself when the batch file is run.

Note that the use of the REM, PAUSE, and ECHO commands to

display on-screen messages slows down the execution of the batch

file appreciably. If you need to include extensive instructions

for a particular batch file, use the TYPE command to have them

displayed on the screen.

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

[For related topics, press R]

SEE ALSO

Batch Files

Creation of Batch Files

AUTOEXEC.BAT File

Displaying of Text with Batch Files

Replaceable Parameters in Batch Files

Loops in Batch Files

Conditional Processing

Chaining of Batch Files

Subroutines for Batch Files

COPY Command

A)Replaceable Parameters in Batch Files

You can define parameters (or arguments) that are passed to

particular command statements in a batch file with the use of

replaceable or dummy parameters. This makes the batch file more

flexible because you get to define the arguments to be passed to

the command statements at the time you execute the batch file.

You can define up to ten different replaceable parameters to

be used in a batch file. Each one is given a number between 0 and

9 preceded by the percent sign, as in %1, %2, and so on. Note,

however, that the replaceable parameter %0 represents a special

case: it is always replaced with the file name of the batch file.

The other nine replaceable parameters have no such fixed

replacements: you can make then stand for DOS commands, file

names, parts of file names (such as extensions), directory paths,

and the like. For instance, you could use replaceable parameters

to create a batch file named WHEREIS.BAT that locates a

particular file for you. This batch file contains only a single

command statement using the replaceable argument, as follows:

CHKDSK /V | FIND ``%1''

The CHKDSK command with the /V parameter lists all of the files

and subdirectories for the current directory and pipes this

information to the FIND command.

The FIND command contains the replaceable parameter %1. When

you execute the WHEREIS.BAT file, you enter the filename you wish

to locate along with the batch file name. To locatea file called

LOAN.FRM on the hard disk, you run the batch fileby entering

WHEREIS LOAN.FRM

DOS will then execute WHEREIS.BAT as though you had entered

CHKDSK /V|FIND ``LOAN.FRM''

as the command statement. If this file is located in C:\WP\FORMS,

DOS will respond by displaying

C:\WP\FORMS\LOAN.FRM

As you can see, you can use this same batch file to search for

any file or group of files, simply by entering a different file

name at the time you execute it.

In complex batch files, you may find that ten replaceable

parameters are not sufficient. In such a case, you can use the

SHIFT command. SHIFT discards each argument after it has been

acted upon, replacing it with the next argument so that after the

first argument is processed, the second becomes the first, the

third the second, and so on. After you use the SHIFT command, the

0% argument is never acted upon, since the %n argument becomes

the %(n--1) argument. Note that SHIFT is useful in loops, which

are described later in this appendix.

Passing Arguments from the Environment

As noted in the SET reference entry, you can specify a set

of strings that the batch files can refer to. For example, if you

enter the SET command

SET REPORT = YREND

and have previously entered the following command line in a batch

file

COPY %REPORT%.WK1 A:

the batch file will copy the file named YREND.WK1 to the floppy

disk in drive A when the batch file is run.

Note that the replaceable argument in the batch file command

line is enclosed in a pair of percent signs (%). This indicates

to DOS that the argument is to be taken from the environment.

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

[For related topics, press R]

SEE ALSO

Batch Files

Creation of Batch Files

AUTOEXEC.BAT File

Displaying of Text with Batch Files

ECHO batch file command

Replaceable Parameters in Batch Files

Loops in Batch Files

Conditional Processing

Chaining of Batch Files

Subroutines for Batch Files

COPY Command

FIND Command

A)Loops in Batch Files

There are several methods for creating loops in batch files.

If you want the entire batch file to repeat, you can use the %0

replaceable parameter as the last command. You will recall that

%0 is always replaced with the file name of the batch file. When

you add it asthe last statement in a batch file, it causes all of

the commands in thefile to be repeated. For example, if you

create a batch file namedDIRA.BAT that contains the command

statements

ECHO OFF

ECHO Insert new disk in drive A

PAUSE

DIR A:/p

%0

the file will repeatedly prompt you to insert a different disk in

drive A and then give you a directory listing of all of the files

it contains when you press a key to continue. This batch file

will continue to repeat until you press Ctrl-C or Ctrl-Break to

terminate it.

The FOR Loop

To repeat a command within a batch file for a specific

number of cases, you use the FOR command. The syntax for the FOR

command is

FOR %%variable IN (set) DO command

where

command Specifies the command to be executed for

each member listed in the (set)

argument, in the order in which these

members are entered. The command

argument can consist of only a single

command, which can be another batch file

command (except for the FOR command), an

executable program, batch file, or DOS

command. Note that you cannot nest FOR

batch commands, which is why the command

argument cannot contain another FOR

command statement.

set Specifies files to be operated upon.

variable Specifies the variable to be operated on

by the command. Notice that a double

percent sign is entered before the

variable (usually, though not

necessarily, a single letter) to

distinguish it from a replaceable

parameter.

Consider this example using the FOR command:

FOR %%A IN (1985.WK1 1986.WK1 1987.WK1)

DO COPY %%A %2

In this batch file, the FOR command statement copies each of the

three worksheet files listed in the (set) argument to the

directory path entered when the batch file is run by passing it

to the %2 replaceable parameter. Notice that the command argument

in this example is actually COPY %%A, instead of just COPY.

The GOTO Command

You can also cause a batch file to execute (and sometimes

repeat) a group of command statements in the file beginning at a

specific point. To do this, you use the GOTO batch command. You

indicate where in the batch file the commands are to be executed

(or repeated) by using a label.

The syntax of the GOTO command is

GOTO [:]label

where

label Specifies a character string of up to

eight alphanumeric characters, and is

not case-sensitive. By convention,

alphabetic characters are entered in

lowercase and the label name is prefaced

by a colon. Note that the colon is

mandatory before the actual label, but

optional before the argument in the

GOTO. The label, however, cannot contain

a period (.).

When you use the GOTO command, DOS executes all of the

command statements listed below the label until it reaches the

end of the batch file or another GOTO statement telling it to

begin reprocessing the commands or to process a new set of

commands beneath another label.

Looping with the GOTO command can be illustrated by the

following generalized form:

:label

command%1

.

.

.

command%n

SHIFT

GOTO :label

Assuming that the commands listed below the :label contain

replaceable parameters, with the use of the SHIFT batch command,

this loop would be executed indefinitely (until you terminated

the batch file by pressing Ctrl-C or Ctrl-Break).

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

[For related topics, press R]

SEE ALSO

Batch Files

Creation of Batch Files

AUTOEXEC.BAT File

Displaying of Text with Batch Files

ECHO batch file command

Replaceable Parameters in Batch Files

Loops in Batch Files

Conditional Processing

Chaining of Batch Files

Subroutines for Batch Files

A)Conditional Processing

The endless loop illustrated above is of limited use in

batch files. It is much more common to use the GOTO command with

conditional statements. That way, the commmands listed beneath

the label are executed only when the condition is true. Using the

GOTO command with conditions allows you to create batch files

that branch according to the result of the condition.

In addition to using conditional processing to branch, you

can also have command statements executed only when there is

equivalency between two items or if a particular file exists.

The IF Command

The batch IF command is used to allow conditional execution

of command statements. The syntax of the IF command is as

follows:

IF [NOT] condition command

If you wish to have branching occur as a result of the outcome of

the condition, use this form:

IF [NOT] condition GOTO [:]label

There is no ELSE command in the batch file command

vocabulary. If you wish to have the program branch to one set of

commands if the condition is true and another if it is false, use

this form:

IF condition GOTO [:]labela

GOTO [:]labelb

If the condition is true, execution jumps to the commands beneath

label a. If it is false, it jumps to those beneath label b. Note

that you do not have to use the second GOTO statement if the

commands to be executed when the condition is false follow the IF

statement directly.

Testing for Equivalence

The condition argument in an IF command can test for

equivalence between two items. If they are found to be equivalent

(that is, identical in terms of characters and case), then the

command statement listed in the command argument is executed.

When you test for equivalence, you use a double equal sign. The

syntax is as follows:

IF string1==string2 command

Note that strings are case-sensitive.

For example, you could enter the following IF command:

IF %1==December GOTO :endofyr

If you execute this batch file and enter December as the first

replaceable parameter, the batch file will jump to the label

:endofyr and execute the commands that are listed beneath it.

Testing for the Existence of a File

You test for the existence of a particular file as the

condition argument of the IF command. The syntax for this use is

as follows:

IF EXIST [d:][path]filename command

The options are as follows:

command Specifies a command to be executed

only when the file entered for the

d:path filename argument is found

on the drive/directory indicated

(if these parameters are omitted,

then in the current directory).

d:pathfilename Specifies the file to be operated

on.

For example, you might have this IF command statement in a

batch file:

IF EXIST 4QTRTOTL GOTO :yrend

The commands beneath the :yrend label are executed only if DOS

locates the file named 4QTRTOTL in the current directory. If this

file is not found, this GOTO statement is ignored.

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

[For related topics, press R]

SEE ALSO

Batch Files

Creation of Batch Files

AUTOEXEC.BAT File

Displaying of Text with Batch Files

ECHO batch file command

Replaceable Parameters in Batch Files

Loops in Batch Files

Conditional Processing

Chaining of Batch Files

Subroutines for Batch Files

A)Chaining of Batch Files

You can chain batch files by adding the name of the second

batch file to be executed as the last statement in the command

statements of the first batch file. Do not confuse chaining batch

files with calling a new batch file as a subroutine. When

chaining batch files, control does not return to the first batch

file as when using subroutines (see the section on Using

Subroutines, which follows). Because of this, reference to the

second batch file must be entered as the last command statement

in the first batch file. If it is not, the commands below this

reference in the first file will never be executed.

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

[For related topics, press R]

SEE ALSO

Batch Files

Creation of Batch Files

AUTOEXEC.BAT File

Displaying of Text with Batch Files

ECHO batch file command

Replaceable Parameters in Batch Files

Loops in Batch Files

Conditional Processing

Subroutines for Batch Files

A)Subroutines for Batch Files

To execute a second batch file as a subroutine (that is,

have control returned to the first batch file upon execution of

all command statements in the second file), you must load a

second copy of the command processor, using the COMMAND command.

The syntax is

COMMAND /C batch

where

/C Tells DOS that this a secondary copy of

the command processor.

batch Specifies the batch file you wish to

call as a subroutine.

To have control return to the first batch file and to have

the secondary copy of the command processor unloaded, the EXIT

command must be the last statement in the batch file used as a

subroutine. If you do not place EXIT as the last command

statement in the called batch file, control will not return to

the calling batch file and the secondary copy of the command

processor will continue to run.

Using The CALL Command

DOS 3.3 has added a CALL command that allows you to call a

second batch file as a subroutine (that is, execute the commands

in a second batch file without terminating the first batch file).

This command can be used in place of the COMMAND and EXIT

commands.

The syntax of the CALL command is

CALL [d:][path]filename

where

d:pathfilename Specifies the name of the

batch file to be called. When

entering this file name, do

not include the .BAT file

extension.

You can use the CALL command to call its own batch file.

However, you need to provide a method whereby the batch file is

eventually terminated.

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

[For related topics, press R]

SEE ALSO

Batch Files

Creation of Batch Files

AUTOEXEC.BAT File

Displaying of Text with Batch Files

ECHO batch file command

Replaceable Parameters in Batch Files

Loops in Batch Files

Conditional Processing

Chaining of Batch Files

COMMAND Command

A)CONFIG.SYS File

Each time you boot up your computer, DOS searches the root

directory of the drive from which it was started for a file named

CONFIG.SYS. If this file is located, DOS executes all of the

commands it contains much like a batch file (although this file

is executed long before an AUTOEXEC.BAT file), according to the

values assigned by special configuration commands. If DOS does

not find this file in the root directory, it supplies its own

default values for all of the configuration commands it requires.

The CONFIG.SYS file is used, then, only when you need to set

new values for particular configuration commands. The parameters

that can be modified in the CONFIG.SYS file include:

þ The BREAK status

þ The number of disk BUFFERS

þ The COUNTRY specification

þ Additional DEVICE drivers

þ The maximum number of drives that you may access

(LASTDRIVE)

þ The maximum number of files that can be open

concurrently by file handlers (FILES)

þ The maximum number of files that can be open

concurrently by file control blocks (FCBS)

þ The SHELL

þ Override the default stack resources (STACKS)

Each of these parameters is explained in this appendix, along

with its associated commands.

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

[For related topics, press R]

SEE ALSO

Creation of CONFIG.SYS File

BREAK Status

BUFFERS Parameter

COUNTRY Parameter

DATE Command

Devices, Drivers for

LASTDRIVE Parameter

FCBS Parameter

FILES Parameter

SHELL Parameter

STACKS Parameter

A)Creation of CONFIG.SYS File

You can create the CONFIG.SYS file using the COPY command,

EDLIN (the line editor supplied with DOS), or any other editor or

word processor that can save its text in ASCII format. If you

create it with a word processor, then save it in ASCII or text

format and copy it to the root directory. To put the commands

that you enter into commission, you must reboot your computer

(Ctrl-Alt-Del, or turn the power off and on ).

To create the CONFIG.SYS file using the COPY command, use

the following model:

COPY CON CONFIG.SYS

Before creating a CONFIG.SYS file for a floppy or your hard disk,

make sure that you are in the root directory (\) before you enter

this command.

After typing this command and pressing the Enter key, you

simply type in each configuration command to be processed when

the CONFIG.SYS file is executed. After typing in each command,

you terminate the line by pressing the Enter key.

Once you have entered all of the configuration command

statements you wish to have in this file, you save it on disk (in

the current directory) by pressing Ctrl-Z (you can also

accomplish this by pressing F6 on IBM PCs and most compatibles)

and the Enter key.

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

[For related topics, press R]

SEE ALSO

CONFIG.SYS File

BREAK Status

BUFFERS Parameter

COUNTRY Parameter

Devices, Drivers for

LASTDRIVE Parameter

FCBS Parameter

FILES Parameter

SHELL Parameter

STACKS Parameter

A)BREAK Status(B

Normally, DOS checks for the BREAK key (Ctrl-Break) only

when performing standard input/output or print operations because

the default for the BREAK command is off. If you want DOS to

check for the BREAK key under more circumstances, set the status

to on by entering

BREAK = ON

as a line in the CONFIG.SYS file. Setting the status to on in

this file will allow you to abort program operations that produce

few or no standard device operations (such as running a

compiler). For more information on the BREAK command, refer to

its reference entry in the main text of the book.

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

[For related topics, press R]

SEE ALSO

CONFIG.SYS File

Creation of CONFIG.SYS File

BUFFERS Parameter

COUNTRY Parameter

Devices, Drivers for

ANSI.SYS

LASTDRIVE Parameter

FCBS Parameter

FILES Parameter

SHELL Parameter

STACKS Parameter

A)BUFFERS Parameter

A disk buffer is a specific block of RAM that DOS uses to

store temporarily data that is being read or written to a disk.

The default number of buffers maintained by DOS is 2. In version

3.3, the number of buffers is set according to these criteria:

þ BUFFERS=3 if you have a disk drive whose capacity

is greater than 360K.

þ BUFFERS=5 if your computer has more than 128K RAM.

þ BUFFERS=10 if your computer has more than 256K

RAM.

þ BUFFERS=15 if your computer has more than 512K

RAM.

Only if none of these apply to your computer system is the

default number of buffers set to 2. Each buffer that is added

with the BUFFERS command uses up an additional 528 bytes of

memory.

To open additional buffers, you use the BUFFERS command

followed by the equal sign and the number of buffers to use in

the CONFIG.SYS file. For example, to increase the number of

buffers from 2 to 10, you would enter

BUFFERS = 10

in a line of the CONFIG.SYS file.

Generally, performance is enhanced when running application

programs when you increase the number of buffers from the default

of 2. However, there is a trade-off that can occur when you have

somewhere between 10 and 20 buffers open (depending upon the type

of application that you are using). At that point, it may take

DOS as much time to locate data in a particular memory buffer as

it would to get the data from disk.

Many DOS application programs, such as WordStar 2000 and

dBASE III PLUS, require many more than 2 buffers in order to run.

During installation of such software, the application's

installation program checks the root directory to make sure first

that the CONFIG.SYS exists and, if it does, to check the number

of buffers open with the BUFFERS command. If the number is less

than 20 (or the BUFFER command is not used in the file), the

program will then automatically enter a BUFFERS command or edit

an existing one to read as follows:

BUFFERS = 20

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

[For related topics, press R]

SEE ALSO

CONFIG.SYS File

Creation of CONFIG.SYS File

BREAK Status

COUNTRY Parameter

Devices, Drivers for

LASTDRIVE Parameter

FCBS Parameter

FILES Parameter

SHELL Parameter

SELECT Command

STACKS Parameter

A)COUNTRY Parameter

You can use the COUNTRY command in a CONFIG.SYS file to

change the currency, date, or time format or the collating

sequence to match that preferred by a foreign country. The syntax

of the COUNTRY command is

COUNTRY = xxx,[yyy],[d:]COUNTRY.SYS

where

xxx Specifies the country code (see SELECT).

yyy Specifies the code page of the desired

country (in DOS 3.3, a country may have

different information depending on the code

page selected- -see Appendix C of the DOS

reference for a listing of the codes).

Note that if you have used the SELECT command, DOS will have

already created a CONFIG.SYS file that includes the COUNTRY

configuration command. To make changes to the COUNTRY codes, you

must then edit the contents of this file using either EDLIN or a

word processor that can read ASCII files.

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

[For related topics, press R]

SEE ALSO

CONFIG.SYS File

Creation of CONFIG.SYS File

BREAK Status

BUFFERS Parameter

Devices, Drivers for

LASTDRIVE Parameter

FCBS Parameter

FILES Parameter

SHELL Parameter

STACKS Parameter

A)Devices, Drivers for

DOS automatically loads device drivers for standard

input/output devices, printers, and storage devices such as

floppy and fixed disk drives. Therefore, you need to use the

DEVICE configuration command in the CONFIG.SYS file only when you

need to install additional nonstandard devices (such as a mouse

or an 8-inch floppy disk drive). The driver files for nonstandard

devices are supplied by the device manufacturer.

To install a new device driver, you enter the DEVICE command

followed by the equal sign and the name of the file that contains

the driver on a line in the CONFIG.SYS file.

The DOS diskette includes two device drivers, ANSI.SYS and

VDISK.SYS. Version 3.3 has added three more device

drivers:DISPLAY.SYS, PRINTER.SYS, and DRIVER.SYS.

ANSI.SYS

The ANSI.SYS driver file extends cursor control and keyboard

reassignments. These extended functions make it easier for

software to control cursor positioning, display messages on the

screen, set colors, and reassign keyboard functions. Some

software applications, such as SuperKey, require that ANSI.SYS be

loaded by theCONFIG.SYS file in order to run.

To add this driver, you enter

DEVICE = [d:][path]ANSI.SYS

on a line of your CONFIG.SYS file, where

d:path Specifies the drive and path.

VDISK.SYS

The VDISK.SYS driver allows you to set up a virtual or RAM

disk that performs the functions of a physical disk drive. A

virtualdisk, however, is installed in RAM and, therefore,

disappears when power is interrupted to the computer system. You

can install more than one virtual disk using the VDISK.SYS

driver, depending upon the amount of RAM available to your

system.

The syntax of the DEVICE configuration command when using

the VDISK.SYS driver is as follows:

DEVICE = [d:][path]VDISK.SYS [comment][bbb]

[comment][sss][comment][ddd][/E[:m]]

Before explaining each optional parameter, consider the

following example that uses all of the options:

DEVICE = C:\DOS\VDISK.SYS buffer size=256

sector size=512 directory entries=128 /E

The options are as follows:

d:path Tells DOS where the VDISK.SYS file is

located (C:\DOS in the example).

bbb Sets the size of the virtual disk in

kilobytes. If you do not specify this

parameter, DOS uses a default of 64K.

You can enter a value between 1K and the

amount of memory available to your

computer. Notice that you can also add

an optional [comment] explaining the

value. In the example, the comment

buffer size= precedes the value in

kilobytes.

sss Sets the sector size in bytes. The

default of 128 bytes is used by DOS if

this parameter is omitted or an

inaccurate value is entered. Allowable

values for the sector size are 128, 256,

or 512 bytes. The sector size parameter

can also be preceded by an optional

comment. In the example, the comment

sector size= has been added.

ddd Sets the number of directory entries

that the virtual disk can hold (one

directory entry per file copied to the

virtual disk). The default is 64, and

you can enter a value between 2 and 512.

However, DOS may automatically adjust

the value you enter when installing the

virtual disk. The value is increased to

the nearest sector boundary (as set by

the sector size). It is decreased if the

size of the virtual disk (as set by the

buffer size) is too small to accommodate

the file allocation table, the

directory, and two additional sectors.

If the directory size reaches 1 and

these files still cannot be

accommodated, you will receive an error

message and the virtual disk will not be

installed.

comment You may enter an optional comment before

the [ddd] parameter. In the example, the

comment directory entries= has been

added.

/E Tells DOS to install the virtual disk in

extended memory AM at or beyond 1

megabyte). This parameter can only be

used with a personal computer that has

extended memory, such as the IBM PC AT

or PS/2 machines (computers equipped

with an add-on board such as the Intel

Above Board support expanded instead of

extended memory). When you add the /E

parameter, the virtual disk buffer is

established in extended memory while the

device driver is installed in

conventional memory. Extended memory up

to 4 megabytes may be used for a single

virtual disk.

:m Specifies the maximum number of sectors

(as specified by the sss parameter) of

data that are transferred to the virtual

disk at one time. The permissible values

are 1 through 8, with 8 being the

default value.

When a virtual disk is established in extended memory,

interrupt servicing is suspended during data transfers. In some

situations, this can result in some interrupts being lost. If

this happens, you should install the virtual disk in conventional

memory. If the problem is resolved, you can then resinstall the

virtual disk in extended memory with a smaller [:m] value.

When you establish a virtual disk, DOS assigns it the next

available drive letter specification. For example, if your

computer has two floppy disk drives, A and B, the virtual disk

will be given C as the drive letter specification. If you have a

single fixed disk, C, the virtual disk will be given D as the

drive letter specification.

DISPLAY.SYS

The DISPLAY.SYS device driver allows you to use code page

switching on the EGA and IBM PS/2 displays and the IBM

Convertible LCD screen. This device driver is included only in

version 3.3 of DOS, which supports code page switching (see the

CHCP and NLSFUNC command reference entries), and it is used only

when you need to switch from the standard for U.S. symbols to new

code pages containing international symbols.

The syntax of the DISPLAY.SYS DEVICE configuration command

is as follows:

DEVICE = [d:][path]DISPLAY.SYS CON[:]=

(type[,[hwcp][,(n,m)]])

The options are as follows:

d:path Specifies the drive letter and path that

contain the DISPLAY.SYS file.

type Specifies the display adapter type. You can

use MONO, CGA, EGA, and LCD. Use EGA if you

have an IBM PS/2 display (VGA is not yet

fully supported).

hwcp Specifies the code page. Permissible values

are 437, 850, 860, 863, and 865 (refer to

Appendix C of the DOS documentation for a

description of these code page values).

n Specifies the number of prepared code pages

that can be supported. This must be a value

between 0 and 12 (refer to the table in the

DOS documentation for the DISPLAY.SYS command

to determine this value).

m Specifies the number of subfonts supported by

each code page (refer to the table in the DOS

documentation for the DISPLAY.SYS command to

determine this value).

Note that if you are using ANSI.SYS with DISPLAY.SYS, the DEVICE

= ANSI.SYS statement must precede the configuration statement

DEVICE = DISPLAY.SYS in the CONFIG.SYS file.

PRINTER.SYS

The PRINTER.SYS device driver allows you to use code page

switching on the IBM Proprinter Model 4201 and the IBM

Quietwriter III Model 5202. Like the DISPLAY.SYS file, this

device driver is included only in version 3.3 of DOS, which

supports code page switching (see the CHCP and NLSFUNC command

reference entries), and it is used only when you need to switch

from the standard for U.S. symbols to new code pages containing

international symbols.

The syntax of the PRINTER.SYS DEVICE configuration command

is as follows:

DEVICE = [d:][path]PRINTER.SYS LPT#[:]=

(type[,[(hwcp1,hwcp2,...)][,n,]])

The options are as follows:

d:path Specifies the drive letter and path

that contain the PRINTER.SYS file.

LPT# Specifies the printer device. It

can be entered up to three times

(for LPT1, LPT2, and LPT3). You can

substitute PRN for LPT in the

command line.

type Specifies the type of printer use.

You can choose between 4201 (IBM

Proprinter) or 5202 (IBM

Quietwriter III).

(hwcp1,hwcp2,...) Specifies the code page that is

built into the hardware. The

permissible values are 437, 850,

860, 863, and 865 (refer to the

PRINTER.SYS command in the DOS

documentation for an explanation of

how these code page values are

applied to the two printer types).

n Specifies the number of additional

code pages that can be prepared.

This value determines the number of

buffers that PRINTER.SYS will set

up to hold the code pages being

prepared. The maximum number that

can be specified is 12.

DRIVER.SYS

The DRIVER.SYS statement in the CONFIG.SYS file allows you

to access and use a disk device by referring to a logical drive

letter. The syntax used when adding this to the CONFIG.SYS file

isas follows:

DEVICE = DRIVER.SYS /D:ddd[/T:ttt][/S:ss][/H:hh]

[/C][/N][/F:f]

The options are as follows:

/D:ddd Specifies the physical drive number between 0

and 255. The first physical diskette drive

(drive A) has the value 0. The second

physical diskette drive (drive B) has the

value 1. The third physical diskette drive

(must be external) has the value 2. The first

fixed drive has the value 128 and the second

has the value 129.

/T:ttt Specifies the number of tracks per side

between 1 and 999 (default: 80).

/S:ss Specifies the number of sectors per track

between 1 and 99 (default: 9).

/H:hh Specifies the number of drive heads between 1

and 99 (default: 2).

/C Specifies that changeline support is required

(only used on computers such as the IBM PC AT

that support diskette changeline).

/N Specifies that the physical device is a non-

removable block device (such as a fixed

disk).

/F:f Specifies the device type (form factor). The

value of the f parameter is determined as

follows:

Device Value

160K/180K 0

320K/360K 0

1.2 megabytes 1

720K or others 2

1.44 megabytes 7

Note that the DEVICE=DRIVER.SYS configuration statement is

not used to drive fixed (hard) disks. To set a logical drive

letter for a fixed disk, use the SUBST command (see the SUBST

reference entry for more information).

To find out the logical drive letter assigned by DOS to the

device driver for a particular computer configuration and value

of /D:, refer to the table included in the DOS documentation

under the reference entry for the DEVICE command.

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

[For related topics, press R]

SEE ALSO

CONFIG.SYS File

Creation of CONFIG.SYS File

BREAK Status

BUFFERS Parameter

COUNTRY Parameter

LASTDRIVE Parameter

FCBS Parameter

FILES Parameter

SHELL Parameter

STACKS Parameter

A)LASTDRIVE Parameter

The highest drive specification letter that DOS 3 will

recognize is drive E (three fixed drives attached: C, D, and E).

If your system has more than this number of logical or physical

drives attached, you must add a LASTDRIVE statement to your

CONFIG.SYS file:

LASTDRIVE = x

where

x Specifies a letter between A and Z. If the drive

letter you specify is less than the number of

drives attached to your system, DOS will ignore

the LASTDRIVE statement in the CONFIG.SYS file.

For example, if you are on a network and you have 15 drive

volumes attached to the system, you would enter

LASTDRIVE = O

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

[For related topics, press R]

SEE ALSO

CONFIG.SYS File

Creation of CONFIG.SYS File

BREAK Status

BUFFERS Parameter

COUNTRY Parameter

Devices, Drivers for

FCBS Parameter

FILES Parameter

SHELL Parameter

STACKS Parameter

A)FCBS Parameter

Some older application programs use file control blocks

(FCBs) instead of the newer file handles to create, open, and

delete files as well as to read from and write to files. When

using these programs on a network with file sharing in use, you

may have to increase the number of files that can be opened by

FCBs. The default value used by DOS is 4 files.

To specify a new number of files that can be concurrently

open by DOS, you use the FCBS command in the CONFIG.SYS file:

FCBS = x,y

where

x Specifies the total number of files that can

be opened by FCBs.

y Specifies the number of files protected from

automatic closure by DOS (the default is 0).

When file sharing is in use and an application program tries

to open more than the total number of files, DOS closes the

least-recently used file and opens the new file (excluding the

files protected from automatic closure). If the program tries to

read from or write to a file that has been closed by DOS, you

will receive the following error message:

FCB unavailable

Abort, Fail?

To avoid such an error, you would add a FCBS command to your

CONFIG.SYS file. For example, entering

FCBS = 10,5

would allow 10 FCB files to be open concurrently and would

protect 5 of these from automatic closure.

When specifying the first parameter (the total number of FCB

files), you can enter a value between 1 and 255. When specifying

the second parameter (the number of files protected from

automatic closure), you can enter a value between 0 and 255. (See

also the SHARE command in the main text.)

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

[For related topics, press R]

SEE ALSO

CONFIG.SYS File

Creation of CONFIG.SYS File

BREAK Status

BUFFERS Parameter

COUNTRY Parameter

Devices, Drivers for

LASTDRIVE Parameter

FILES Parameter

SHARE Command

SHELL Parameter

STACKS Parameter

A)FILES Parameter

By default, DOS allows up to 8 files (controlled by file

handles, not FCBs) to be open concurrently. This number is

insufficient to run several newer application programs as well as

some DOS commands (such as XCOPY).

If you receive either the error message

Too many open files

or

Too many files open

you will have to use the FILES configuration command in the

CONFIG.SYS file to increase the maximum number of files available

to the entire system:

FILES = n

where

n Specifies the number of files that can be

opened at the same time (a value between 8

and 255). However, be aware that the maximum

number of files that a single process can

have opened is set at 20.

To accommodate 15 different files being open at one time, you

would enter

FILES = 15

as a line in the CONFIG.SYS file.

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

[For related topics, press R]

SEE ALSO

CONFIG.SYS File

Creation of CONFIG.SYS File

BREAK Status

BUFFERS Parameter

COUNTRY Parameter

Devices, Drivers for

LASTDRIVE Parameter

FCBS Parameter

SHELL Parameter

STACKS Parameter

XCOPY Command

A)SHELL Parameter

Normally, DOS loads the command processor from the

COMMAND.COM file during the boot sequence. If you have your own

command processor, you can have it initialized and loaded at

start-up in place of COMMAND.COM by using the SHELL configuration

command.

The syntax of the SHELL command is

SHELL = [d:][path]filename [/E:xxxxx][/P]

where

d:pathfilename Specifies the file name of the new

command processor (including its

path, if it is not located in the

root directory). Using COM-MAND.COM

as the file name is a convenient

way to increase the environment

size under DOS 3.2 and 3.3.

/E:xxxxx Specifies the number of bytes for

the environment size (expressed as

a base-10 integer between 160 and

32768).

/P Causes COMMAND.COM to remain loaded

and to execute the AUTOEXEC.BAT

file (if one exists).

Note that using the SHELL command to run a different command

processor does not affect the COMSPEC command, which points to

the name of the controlling processor (see SET in the reference

entries). If you use the SHELL command in the CONFIG.SYS file to

load a new command processor, you will also want to use the

COMSPEC parameter in the SET command in the AUTOEXEC.BAT file to

refer to it.

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

[For related topics, press R]

SEE ALSO

CONFIG.SYS File

Creation of CONFIG.SYS File

BREAK Status

BUFFERS Parameter

COUNTRY Parameter

Devices, Drivers for

LASTDRIVE Parameter

FCBS Parameter

FILES Parameter

STACKS Parameter

A)STACKS Parameter

DOS 3.3 includes a STACKS configuration command that allows

you to override the default stack resources used by DOS. The

syntax of this command is

STACKS = n,s

where

n Specifies the number of stack frames between

8 and 64.

s Specifies the size in bytes of each stack

frame between 32 and 512.

If the STACKS command is not included in the CONFIG.SYS

file, the n and s parameters are set to 0 for the IBM PC, IBM PC

XT, and the IBM Portable PC. For all other IBM personal

computers, the default values are n = 9 and s = 128.

Every time a hardware interrupt occurs, DOS appropriates one

stack frame from the stack pool. Once the interrupt has been

processed, DOS returns the stack frame to the pool. If you

experience stack overflow errors, you should use the STACKS

command to increase the number of stack frames available to DOS.

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

[For related topics, press R]

SEE ALSO

CONFIG.SYS File

Creation of CONFIG.SYS File

BREAK Status

BUFFERS Parameter

COUNTRY Parameter

Devices, Drivers for

LASTDRIVE Parameter

FCBS Parameter

FILES Parameter

SHELL Parameter

A)Hard Disk Partitions

Hard disks are usually so large that they can contain more

than one type of operating system. For example, you can have DOS

3.3 manage one part of a disk and UNIX manage another. Each of

these sections is called a partition. You can have from one to

four partitions on a disk.

Partitions are used to make the hard disk, especially a very

large one, a more economical investment. They allow you to

effectively have up to four completely different computer systems

resident in one set of hardware. However, since they do not share

a common software environment, they cannot share data directly.

Two types of partitions can be set up for DOS: a primary DOS

partition and an extended DOS partition. The primary DOS

partition is the partition that contains DOS and is the first

partition on the disk. This is the only partition that must be on

the disk if your disk is no larger than 32 megabytes. The

extended DOS partition is a separate partition that cannot be

used for booting, but can be divided into separate logical

drives.

If you have more than 32 megabytes available on one hard

disk, you will need to create an extended DOS partition, which is

assigned the next logical drive letter. For example, if you had a

60-megabyte hard disk drive, and wanted access to all of it, you

would create a 32-megabyte primary partition and a 28-megabyte

extended partition. The primary partition could be accessed as

drive C, while the extended partition would be called drive D.

You could also subdivide the extended partition into more logical

drives (up to the letter Z).

You must create partitions before using a hard disk drive.

You will probably take the easiest route by simply making the

entire disk into one primary partition. The FDISK program

presented here, however, is necessary in several more advanced

situations. For example, you may plan on using multiple operating

systems from the same disk. FDISK will let you set up unique

partitions for each system. (Each of these would be a primary

partition, but only one could be designated the active partition,

the one that will gain control at boot up.) Then again, you may

be using one of the large hard disks (40 to 70 megabytes) that

are increasingly common. Since DOS can only access a logical

drive of 32 megabyte or less, you'll need to partition a larger

physical drive into multiple logical drives. Only in this way can

you store and retrieve information on the larger hard disk.

Note: If your disk is already being used and you wish to

make a new partition, you will have to first back up all of your

data and then run FDISK from a system diskette. Finally, you'll

need to reformat your disk before restoring your files to it.

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

[For related topics, press R]

SEE ALSO

Configuration of DOS Partitions

Active Partitions, Changing of

Displaying of Partition Information

Deletion of DOS Disk Partitions

A)Configuration of DOS Partitions

In this section, you will see exactly how to use the FDISK

command. This procedure is very important, and it can have

serious consequences if done incorrectly. However, it can also

make your system more efficient, when done properly. FDISK is

only usable on hard disk systems.

Invoking the FDISK command is as simple as typing

FDISK

and pressing Return. emember to have your path set properly to

include the directory containing the FDISK command file.) After

this command creates the appropriate partition(s), you must then

logically format the disk.

Warning: All data on your disk will be destroyed when you

create partitions with FDISK.

When you first execute FDISK, the screen will clear and the

FDISK Options screen will appear. This contains the menu used to

get around in FDISK, as shown in the screen below.

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

FDISK Options

Current Fixed Disk Drive: 1

Choose one of the following:

1. Create DOS partition

2. Change Active Partition

3. Delete DOS partition

4. Display Partition Information

Enter choice: [1]

Press ESC to return to DOS

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

As you can see, there are four choices. If you have a system

with more than one hard disk drive, the number in the Current

Fixed Disk Drive: 1 line would be changed to the number of drives

in your system. Also, a fifth option, Select Next Fixed Disk

Drive, would be displayed on the screen. You can work on only one

hard disk drive at a time, but you can switch from the drive you

are working on to another drive. For now, let's assume you have

one hard disk drive and that the screen below is what you see.

Creating a Partition

The first option on the FDISK Options menu is to create a

DOS partition. Since you are using DOS, and not another operating

system such as UNIX, you can only create DOS partitions. Should

you wish to put another operating system onto the disk, that

system would have its own version of FDISK and could then create

its own partitions next to DOS'.

Tip: If you plan to use your hard disk to support another

operating system, do not partition the whole disk. Leave some

room so that another system can be loaded onto the disk.

Choosing the first option to create a DOS partition results

in the screen below.

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

Create DOS Partition

Current Fixed Disk Drive: 1

1. Create Primary DOS partition

2. Create Extended DOS partition

Enter Choice: [1]

Press ESC to return to FDISK Options

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

If you select option 2 at this point, intending to create an

extended DOS partition before creating a primary partition, DOS

will display a message indicating that you cannot do so, and will

suggest that you press Esc to return to the main FDISK Options

menu. Assuming you are starting from scratch, you would select

choice 1 to create the primary DOS partition. You will then see

the screen shown below.

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

Create Primary DOS Partition

Current Fixed Disk Drive: 1

Do you wish to use the maximum size

for a DOS partition and make the DOS

partition active (Y/N).........? [n]

Press ESC to return to FDISK Options

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

If you want to use the whole disk for DOS, then you answer Y

on this screen. Doing so makes DOS use the whole disk. The

computer will allocate the entire disk, and then come back with

the message

System will now restart

Insert DOS diskette in drive A:

Press any key when ready . . .

Since you just created the partition, there is still nothing on

the hard disk. The system must be rebooted from the disk drive.

You can now format the entire hard disk just as you would a

floppy diskette.

If you answer N, you have the opportunity to create a

smaller partition, as shown in the screen below. As you can see,

there are 305 cylinders available on the total disk. A hard disk

consists of several platters, similar to a diskette; each platter

consists of a series of concentric tracks made up of sectors.

Each platter lies above another and is read by a different disk

head. Viewed vertically, a series of tracks (with the same track

number, but on different platters) located one above the other

constitute a cylinder. The brackets in the screen shown below

indicate the place where you may enter a number for cylinders

that is less than the default maximum (305 on this disk).

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

Create Primary DOS Partition

Current Fixed Disk Drive: 1

Total disk space is 305 cylinders.

Maximum space available for partition

is 305 cylinders.

Enter partition size...........: [ 200]

No partitions defined

Press ESC to return to FDISK Options

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

Notice that the second-to-last line on the screen tells you

that no partitions have been defined yet. If you are using your

disk for DOS alone, you should accept the default maximum

cylinder value. All disk space will then be available for DOS and

your DOS files. If you plan on splitting up your disk between DOS

and another operating system, however, you'll have to decide for

yourself what percentage of total disk space is needed for the

other operating system. In this example, you intend to create an

extended DOS partition, so 200 was entered for the number of

cylinders in the primary DOS partition.

Entering 200 results in the screen shown below. This screen

tells you that the first partition on drive C is a primary DOS

partition (PRI DOS) that starts at cylinder 0 and ends at

cylinder 199, constituting a total of 200 cylinders.

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

Create Primary DOS Partition

Current Fixed Disk Drive: 1

Partition Status Type Start End Size

C: 1 PRI DOS 0 199 200

Primary DOS partition created

Press ESC to return to FDISK Options

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

Pressing Esc at this point returns you to the FDISK Options

menu. If you again try to create a primary partition, DOS will

show the following message on your screen:

Primary DOS partition already exists.

Press ESC to return to FDISK Options

Note: There can only be one primary DOS partition. When DOS

boots up, the system files from this partition are loaded into

memory for your operations. In this example, you have only used

200 cylinders out of a possible 305, so you can make an extended

DOS partition. To do so, you select choice 1 (create a DOS

partition) on the FDISK Options menu and then select choice 2

(create Extended DOS partition) on the Create DOS Partition menu.

The resulting screen, shown below, allows you to create an

extended DOS partition. This screen tells you the current

partition information- -that is, that there are 305 total

cylinders available for use- -and also tells you that 105

cylinders remain unused. The 105 value is used as the default

entry at this stage. You only need to type in a number over the

105 to override the default. In the screen below, 55 was entered

for the desired extended DOS partition, leaving 50 cylinders

unused on the disk for another operating system.

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

Create Extended DOS Partition

Current Fixed Disk Drive: 1

Partition Status Type Start End Size

C: 1 PRI DOS 0 199 200

Total disk space is 305 cylinders.

Maximum space available for partition

is 105 cylinders.

Enter partition size............: [ 55]

Press ESC to return to FDISK Options

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

The screen will now clear, redisplay the partition

information (including that on the new extended DOS partition),

and print the message

Extended DOS Partition created

Press ESC to return to FDISK Options

near the bottom of the screen. Pressing Esc will result in the

next step of the process (see screen below).

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

Create Logical DOS Drive(s)

No logical drives defined

Total partition sized is 55 cylinders.

Maximum space available for logical

drive is 55 cylinders.

Enter logical drive size..........: [ 45]

Press ESC to return to FDISK Options

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

Since you have just created an extended DOS partition, DOS

wants to know if you want to create logical drives within this

new partition. It tells you the total available cylinders in the

partition and asks you to enter a size for the logical drive. In

this example, you enter 45. The resulting screen will contain the

logical drive information (drive name, starting cylinder, ending

cylinder, and total cylinders used).

Suppose you wanted to create another logical drive, E, using

the remaining ten cylinders. You could again choose option 1 on

the FDISK Options menu. You would go again to the Create DOS

Partition menu, but there would be one new choice displayed:

3. Create logical DOS drive(s) in

the Extended DOS partition

This would bring you back to the screen for defining logical

drives, where you could then enter the information for drive E.

Going through this same sequence again in order to use the

remaining ten cylinders will result in the screen below. Notice

that the cylinder numbers are within the bounds of the extended

DOS partition. You are told that DOS created two logical drives,

D and E, with sizes of 45 and 10 cylinders. Furthermore, you're

reminded that no more available space remains for any other

logical drives. Press Esc, and you will once again be back at the

FDISK Options menu.

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

Create Logical DOS Drive(s)

Drv Start End Size

D: 200 244 45

E: 245 254 10

All available space in the Extended DOS

partition is assigned to logical drives.

Logical DOS drive created, drive letters

changed or added

Press ESC to return to FDISK Options

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

If you try to create another extended partition, you will

get a partition information screen and the message

Extended DOS partition already exists.

Press ESC to return to FDISK Options

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

[For related topics, press R]

SEE ALSO

Active Partitions, Changing of

Deletion of DOS Disk Partitions

Displaying of Partition Information

FDISK Command

Hard Disk Partitions

A)Active Partitions, Changing of

The active partition is the partition that is used to boot

the system. It is the default partition. Choosing option 2 on the

main FDISK Options menu leads you to a menu like that shown in

the screen below, in which the partition information is displayed

along with the total number of cylinders available on the disk.

FDISK now wants to know the number of the partition that you wish

to make active.

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

Change Active Partition

Current Fixed Disk Drive: 1

Partition Status Type Start End Size

C: 1 PRI DOS 0 199 200

2 EXT DOS 200 254 55

Total disk space if 305 cylinders.

Enter the number of the partition you

want to make active.............: [2]

Partition selected (2) is not bootable,

active partition not changed.

Press ESC to return to FDISK Options

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

If you enter the number 2, as shown in the figure, DOS will

inform you that only the primary DOS partition (1) may be made

active. Type the number 1 so that the primary DOS partition will

have control when the system comes up. Pressing Return will

result in the adjusted partition information display seen below.

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

Change Active Partition

Current Fixed Disk Drive: 1

Partition Status Type Start End Size

C: 1 A PRI DOS 0 199 200

2 EXT DOS 200 254 55

Total disk space is 305 cylinders.

Partition 1 made active

Press ESC to return to FDISK Options

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

Notice the letter A on the first line of this display. An A

under Status tells you that partition 1 is the active partition.

Pressing Esc takes you back to the FDISK Options menu.

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

[For related topics, press R]

SEE ALSO

Configuration of DOS Partitions

Deletion of DOS Disk Partitions

Displaying of Partition Information

FDISK Command

Hard Disk Partitions

A)Displaying of Partition Information

Option 4 on the FDISK Options menu is used to display

information about the partitions. This is useful because no extra

functions will be executed at the same time; you can simply look

at the information. Choosing option 4 yields the screen shown

below.

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

Display Partition Information

Current Fixed Disk Drive: 1

Partition Status Type Start End Size

C: 1 A PRI DOS 0 199 200

2 EXT DOS 200 254 55

Total disk space is 305 cylinders.

The Extended DOS partition contains

logical DOS drives. Do you want to

display logical drive information? [Y]

Press ESC to return to FDISK Options

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

The information at the top of the screen is familiar by now.

But what if you want to see information about the logical drives

that have been defined? Look at the bottom half of the screen,

where you are asked if you want to see this information. Replying

with Y results in a display of information about these logical

drives (see the screen below). Pressing Esc at this point will

return you to the FDISK Options menu.

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

Display Logical DOS Drive Information

Drv Start End Size

D: 200 244 45

E: 245 254 10

Press ESC to return to FDISK Options

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

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

[For related topics, press R]

SEE ALSO

Active Partitions, Changing of

Configuration of DOS Partitions

Deletion of DOS Disk Partitions

FDISK Command

Hard Disk Partitions

A)Deletion of DOS Disk Partitions

As with most things, what DOS giveth, DOS can taketh away- -

with a little prodding from you. Selecting choice 3 on the FDISK

Options menu produces the Delete DOS Partition menu, shown below.

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

Delete DOS Partition

Current Fixed Disk Drive: 1

Choose one of the following:

1. Delete Primary DOS partitions

2. Delete Extended DOS partition

3. Delete logical DOS drive(s) in

the Extended DOS Partition

Enter choice: [ ]

Press ESC to return to FDISK Options

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

Using this menu, you can delete any of the information

you've already set up. You may want to expand or contract other

partitions, or you may no longer want to use a partition in the

manner you originally designed. In any case, you can only make

changes in a certain order. You cannot delete the primary DOS

partition without first deleting the extended DOS partition. If

you try, DOS will give you this message:

Cannot delete Primary DOS partition on

drive 1 when Extended partition exists

Press ESC to return to FDISK Options

In addition, you cannot delete an extended DOS partition

without first ``undefining'' (deleting) the logical drives in

that partition. Trying to delete the extended DOS partition

before deleting the drives in it will simply display the current

partition information with the patient message

Cannot delete Extended DOS partition

while logical drives exist.

Press ESC to return to FDISK options

Choice 3 in the Delete DOS Partition menu is probably the

first selection you will need to make; you work your way

backwards through the order in which you created things.

ctually, you will find that this is a fairly natural process.)

Selecting choice 3 produces the screen shown below, which

contains the logical drive information and the size of the

extended DOS partition the drives are in. You are also warned

that any data contained in the logical disk drive to be deleted

will also be deleted. If you still want to delete the drive,

simply enter the drive identifier. You will then be asked to

confirm this step. In the screen below, you have selected drive E

to delete first, and confirmed the choice by typing Y. If you had

entered N, you would have been returned to the FDISK Options

menu.

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

Delete Logical DOS Drive

Drv Start End Size

D: 200 244 45

E: 245 254 10

Total partition size is 55 cylinders.

Warning! Data in the logical DOS drive

will be lost. What drive do you wish

to delete.........................? [e]

Are you sure......................? [y]

Press ESC to return to FDISK Options

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

Once FDISK deletes the logical drive, it updates the display

at the top of the screen and asks for another drive to delete. If

you wanted to regain all the space used by this partition, you

would then enter drive D, confirm your entry, and end up with the

screen shown below. Pressing Esc twice at this point would

bring you back up through the menu screens to the main FDISK

Options menu.

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

Delete Logical DOS Drive

Drv Start End Size

D: drive deleted

E: drive deleted

Total partition size is 55 cylinders.

All logical drives deleted in the

Extended DOS partition

Press ESC to return to FDISK Options

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

Now that the logical drives are gone, you can delete the

extended DOS partition itself if you choose to do so. Choosing

option 2 on the Delete DOS Partition menu results in the familiar

form of an FDISK screen (see below). Again, you are shown the

partition information display, warned that data will be lost, and

asked if you really want to delete the extended DOS partition.

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

Delete Extended DOS Partition

Current Fixed Disk Drive: 1

Partition Status Type Start End Size

C: 1 A PRI DOS 0 199 200

2 EXT DOS 200 254 55

Warning! Data in the Extended DOS

partition will be lost. Do you wish

to continue.......................? [y]

Press ESC to return to FDISK Options

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

If you reply Y, the screen will be updated to show only the

primary DOS partition and the message

Extended DOS partition deleted

Press ESC to return to FDISK Options

Press Esc to return once again to the FDISK Options menu.

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

[For related topics, press R]

SEE ALSO

Active Partitions, Changing of

Configuration of DOS Partitions

Displaying of Partition Information

FDISK Command

Hard Disk Partitions

A)active partition

The section of a hard disk containing the operating system to be

used when the hardware powers up.

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

[For related topics, press R]

SEE ALSO

hard disk

hardware

A)ANSI driver

A device driver, contained in the ANSI.SYS file, that loads

additional support for advanced console features.

A)application program

A program that performs or replaces a manual function, such as

balancing a checkbook or managinginventory.

A)archive bit

A bit in a file specification used to indicate whether the file

in question needs to be backed up.

A)ASCII

American Standard Code for Information Interchange. The coding

scheme whereby every character the computer can access is

assigned an integer code between 0 and 255.

A)assembly language

A symbolic form of computer language used to program computers at

a fundamental level.

A)asynchronous communications

See serial communications.

A)AUTOEXEC.BAT

A batch file executed automatically whenever the computer is

booted up.

A)background task

A second program running on your computer; usually, a printing

operation that shares the CPU with your main foreground task.

A)base name

The portion of a file name to the left of the period separator;

it can be up to eight characters long.

A)BASIC

Beginner's All-purpose Symbolic Instruction Code. A computer

language similar to the English language.

A)batch file

An ASCII file containing a sequence of DOS commands that, when

invoked, will assume control of the computer, executing the

commands as if they were entered successively by a computer user.

A)baud rate

The speed of data transmission, usually in bits per second.

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

[For related topics, press R]

SEE ALSO

bit

binary

byte

A)binary

A numbering system that uses powers of 2 to generate all other

numbers.

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

[For related topics, press R]

SEE ALSO

baud rate

bit

byte

A)bit

One-eighth of a byte. A bit is a binary digit, either 0 or 1.

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

[For related topics, press R]

SEE ALSO

baud rate

binary

A)bit mapping

The way a graphics screen is represented in the computer. Usually

signifies point-to-point graphics.

A)booting up

See bootstrapping.

A)boot record

The section on a disk that contains the minimum information DOS

needs to start the system.

A)bootstrapping

When the computer initially is turned on or is rebooted from the

keyboard with Ctrl-Alt-Del, it ``pulls itself up by its

bootstraps.'' See also warm booting, cold booting.

A)branching

The transfer of control or execution to another statement in a

batch file. See also decision making.

A)Break key

The control-key combination that interrupts an executing program

or command; activated by pressing the Scroll Lock/Break key while

holding down the Ctrl key.

A)buffer

An area in memory set aside to speed up the transfer of data,

allowing blocks of data to be transferred at once.

A)byte

The main unit of memory in a computer. A byte is an 8-bit binary-

digit number. One character usually takes up one byte.

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

[For related topics, press R]

SEE ALSO

binary

bit

baud rate

A)cache

A portion of memory reserved for the contents of recently

referenced disk sectors. Facilitates faster reaccess of the

same sectors.

A)case sensitivity

Distinguishing between capital letters and lowercase letters.

A)chaining

Passing the control of execution from one batch file to another.

This represents an unconditional transfer of control.

A)character set

A complete group of 256 characters can be used by programs or

system devices. Consists of letters, numbers, control codes, and

special graphics or international symbols. See also code page.

A)cluster

A group of contiguous sectors on a disk. This is the smallest

unit of disk storage that DOS can manipulate.

A)COBOL

A programming language usually used for business applications.

A)code page

A character set that redefines the country and keyboard

information for non-n-U.S. keyboards and systems.

A)cold booting

When the computer's power is first turned on and DOS first boots

up. See bootstrapping.

A)COMMAND.COM

The command processor that comes with DOS.

A)command line

The line on which a command is entered. This line contains the

command and all of its associated parameters and switches. It may

run to more than one screen line, but it is still one command

line.

A)command processor

The program that translates and acts on commands.

A)compressed print

Printing that allows more than 80 characters on a line of output

(usually 132 characters, but on newer printers up to255

characters per line).

A)computer-aided design (CAD) program

A sophisticated software package containing advanced graphics and

drawing features.Used by engineers, architects, and designers for

drawing and de-sign applications.

A)concatenation

The placing of two or more text files together in a series.

A)conditional statement

A statement in a batch file that controls the next step to be

executed in the batch file, based on the value of a logical test.

A)CONFIG.SYS

An ASCII text file containing system configuration commands.

A)configuration

An initial set of system values, such as the number of buffers

DOS will use, the number of simultaneously open files it will

allow, and the specific devices that will be supported.

A)console

The combination of your system's monitor and keyboard.

A)contiguity

That the disk sectors used by a file are physically adjacent on a

disk.

A)control codes

ASCII codes that do not display a character but perform a

function, such as ringing a bell or deleting a character.

A)copy protection

Special mechanisms contained in diskettes to inhibit the copying

of them by conventional commands.

A)CPU

Central Processing Unit. The main chip that executes all

individual computer instructions.

A)Ctrl-Z

The end-of-file marker.

A)cursor

The blinking line or highlighted box that indicates where the

next keystroke will be displayed or what the next control code

entered will affect.

A)cutting and pasting

Selecting text from one part of a document or visual display and

moving it to another location.

A)cylinder

Two tracks that are in the same place on different sides of a

double-sided disk. May be extended to include multiple platters.

For example, Side 0 Track 30, Side 1 Track 30, Side 2 Track 30,

and Side 3 Track 30 form a cylinder.

A)daisy-wheel printer

A printer that uses circular templates for producing letter-

quality characters.

A)data area

The tracks on a disk that contain user data.

A)database

A collection of data organized into various categories. A phone

book is one form of database.

A)database management system

A software program designed to allow the creation of specially

organized files, as well as data entry, manipulation, removal,

and reporting for those files.

A)data bits

The bits that represent data when the computer is communicating.

A)data disk

A disk that has been formatted without the /S switch. The disk

can contain only data; no room has been reserved for system

files.

A)data stream

The transmission of data between two components or computers.

A)dead key

A reserved key combination on international keyboards, which

outputs nothing itself but allows the next keystroketo produce an

accent mark above or below the keystroke's usualcharacter.

A)debugging

The process of discovering what is wrong with a program, where

the problem is located, and what the solution is.

A)decimal

A numbering system based on ten digits.

A)decision making

A point in a batch file at which execution can continue on at

least two different paths, depending on the results of a program

test. Also known as logical testing or branching.

A)default

The standard value of a variable or system parameter.

A)deferred execution

In a program or batch file, when execution is delayed until a

value for some parameter is finally entered or computed.

A)delimiter

A special character, such as a comma or space, used to separate

values or data entries.

A)destination

The targeted location for data, files, or other information

generated or moved by a DOS command.

A)device

Any internal or external piece of peripheral hardware.

A)device driver

Also known as an interrupt handler. A special program that must

be loaded to use a device. Adds extra capability to DOS.

A)device name

Logical name that DOS uses to refer to a device.

A)digital

A representation based on a collection of individual digits, such

as 0s and 1s in the binary number system.

A)digitizer

A device with a movable arm that can take an image and break it

up into small parts, which the computer translates into bits.

A)directory

A grouping of files on a disk. These files are displayed together

and may include access to other directories (subdirectories).

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

[For related topics, press R]

SEE ALSO

directory tree

file

path

subdirectory

A)directory tree

The treelike structure created when a root directory has several

subdirectories, each of the subdirectories has subdirectories,

and so on.

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

[For related topics, press R]

SEE ALSO

directory

file

path

subdirectory

A)disk drive

A hardware device that accesses the data stored on a disk.

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

[For related topics, press R]

SEE ALSO

hardware

A)diskette

A flexible, oxide-coated disk used to store data. Also called a

floppy diskette.

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

[For related topics, press R]

SEE ALSO

disk drive

hardware

A)disk optimizer

A program that rearranges the location of files stored on a disk

in order to make the data in those files quickly retrievable.

A)DOS

Disk Operating System. A disk manager and the program that allows

computer/user interaction.

A)DOS environment

A part of memory set aside to hold the defaults needed in the

current environment, such as COMSPEC, PATH, LASTDRIVE, and so on.

A)DOS prompt

Usually C or A. The visual indication that DOS is waiting for a

command or prompting you for input.

A)dot-matrix printer

A printer that represents characters by means of tiny dots.

A)double-density diskette

A diskette on which magnetic storage material is arranged twice

as densely as usual, allowing the storage of twice the usual

amount of data. Generally refers to a 360K, 5-inch diskette.

A)drive identifier

A single letter assigned to represent a drive, such as drive A or

drive B. Usually requires a colon after it, such as A:.

A)DRIVER.SYS

A file containing a device driver for an extra external disk

drive. Used in the CONFIG.SYS file.

A)dual tasking

Causing two tasks or programming events to occur simultaneously.

A)echoing

Displaying on your video monitor the keystrokes you type in.

A)EDLIN

The DOS line editor.

A)end-of-file marker

A Ctrl-Z code that marks the logical end of a file.

A)environment

The context within which DOS interfaces with you and with your

commands.

A)error level

A code, set by programs as they conclude processing, that tells

DOS whether an error occurred, and if so, the severity of that

error.

A)expansion cards

Add-on circuit boards through which hardware can increase the

power of the system, such as adding extra memory or a modem.

A)expansion slots

Connectors inside the computer in which expansion cards are

placed so that they tie in directly to the system.

A)extended ASCII codes

ASCII codes between 128 and 255, which usually differ from

computer to computer.

A)extended DOS partition

A hard-disk partition used to exceed the 32 megabyte, single-disk

barrier; it can be divided into logical disk drives.

A)extended memory

Additional physical memory beyond the DOS 1 megabyte addressing

limit.

A)extension

The one to three characters after the period following the base

name in a file specification.

A)external buffer

A device, connected to the computer and another device, that acts

as a buffer.

A)file

A collection of bytes, representing a program or data, organized

into records and stored as a named group on a disk.

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

[For related topics, press R]

SEE ALSO

directory

directory tree

path

subdirectory

A)file allocation table (FAT)

A table of sectors stored on a disk, which tells DOS whether a

given sector is good, bad, continued, or the end of a chain of

records.

A)file name

The name of a file on the disk. Usually refers to the base name,

but can include the extension as well.

A)file version

A term that refers to which developmental copy of a software

program is being used or referenced.

A)filter

A program that accepts data as input, processes it in some

manner, and then outputs the data in a different form.

A)fixed disk

IBM's name for a hard disk.

A)floppy diskette

See diskette.

A)flow of control

The order of execution of batch file commands; how the control

flows from one command to another, even when the next command to

be executed is not located sequentially in the file.

A)foreground task

The main program running on your computer, as opposed to the less

visible background task (usually a print-ing job).

A)formatting

The placement of timing marks on a disk to arrange the tracks and

sectors for subsequent reading and writing.

A)fragmentation

A condition in which many different files have been stored in

noncontiguous sectors on a disk.

A)function keys

Special-purpose keys on a keyboard, which can be assigned unique

tasks by DOS or by application programs.

A)global characters

See wildcards.

A)graphics mode

The mode in which all screen pixels on a monitor are addressable

and can be used to generate detailed images. Contrasts with text

mode, which usually allows only 24 lines of 80 characters.

A)hard disk

A rigid platter that stores data faster and at a higher density

than a floppy diskette. Sealed in an airtight compartment to

avoid contaminants that could damage or destroy the disk.

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

[For related topics, press R]

SEE ALSO

active partition

head

hardware

A)hardware

The physical components of a computer system.

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

[For related topics, press R]

SEE ALSO

active partition

diskette

hard disk

disk drive

A)hardware interrupt

A signal from a device to the computer, indicating that an event

has taken place.

A)head

A disk-drive mechanism that reads data from and writes data to

the disk.

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

[For related topics, press R]

SEE ALSO

hard disk

head crash

A)head crash

Occurs when the head hits the disk platter on a hard disk,

physically damaging the disk and the data on it.

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

[For related topics, press R]

SEE ALSO

head

A)help file

A file of textual information containing helpful explanations of

commands, modes, and other on-screen tutorial information.

A)hexadecimal

A numbering system in base 16. A single 8-bit byte can be fully

represented as two hexadecimal digits.

A)hidden files

Files whose names do not appear in a directory listing. Usually

refers to DOS' internal system files, but can also refer to

certain files used in copy-protection schemes.

A)high-capacity diskette

A 1.2 megabyte, 5--inch floppy diskette.

A)high-resolution mode

The mode on a video monitor in which all available pixels are

used to provide the most detailed screen image possible. On a

color monitor, this mode reduces the possible range of colors

that can be output.

A)horizontal landscape

When output to a printer is not done in the usual format, but

rather with the wider part of the paper laid out horizontally, as

in a landscape picture.

A)hot key

A key combination used to signal that a memory-resident program

should begin operation.

A)housekeeping

Making sure the directory stays intact and well organized, and

that unnecessary files are deleted.

A)hub

The center hole of a diskette.

A)IF

A conditional statement in a batch file.

A)ink-jet printer

A printer that forms characters by spraying ink in a dot pattern.

See dot-matrix printer.

A)interface

The boundary between two things, such as the computer and a

peripheral.

A)interrupt

A signal sent to the computer from a hardware device, indicating

a request for service or support from the system.

A)keyboard translation table

An internal table, contained in the keyboard driver, that

converts hardware signals from the keyboard into the correct

ASCII codes.

A)key combination

When two or more keys are pressed simultaneously, as in Ctrl-

Scroll Lock or Ctrl-Alt-Del.

A)key redefinition

Assigning a nonstandard value to a key.

A)kilobyte (K)

1024 bytes.

A)laser printer

A printer that produces images (pictures or text) by shining a

laser on a photostatic drum, which picks up toner and then

transfers the image to paper.

A)LCD

Liquid Crystal Display. A method of producing an image using

electrically sensitive crystals suspended in a liquid medium.

A)letter-quality printer

A printer that forms characters that are comparable to those of a

typewriter.

A)line editor

A program that can make textual changes to an ASCII file, but can

only make changes to one line of the file at a time.

A)line feed

When the cursor on a screen moves to the next line, or when the

print head on a printer moves down the paper to the next line.

A)literal

Something that is accepted exactly as it was submitted.

A)lockup

Occurs when the computer will not accept any input and may have

stopped processing. Requires that the computer be warm or cold

booted to resume operating.

A)log file

A separate file, created with the BACKUP command, that keeps

track of the names of all files written to the backup

diskette(s).

A)logging on

Signing onto a remote system, such as a mainframe or

telecommunications service.

A)logical

Something that is defined based on a decision, not by physical

properties.

A)logical drives

Disk drives, created in an extended DOS partition, that do not

physically exist, but DOS operates as if they do. A means for DOS

to access a physical disk that has more than 32 megabytes

available.

A)logical testing

See decision making.

A)machine language

The most fundamental way to program a computer, using

instructions made up entirely of strings of 0sand 1s.

A)macro

A set of commands, often memory-resident. When executed, they

appear to the program executing them as if they were being

entered by you.

A)medium-resolution mode

The mode on a Color Graphics Adapter in which only 320x200 pixels

of resolution are allowed.

A)megabyte (Mb)

1024 kilobytes.

A)memory

The circuitry in a computer that stores information. See also RAM

and ROM.

A)memory-resident

Located in physical memory, as opposed to being stored in a disk

file.

A)menu

A set of choices displayed in tabular format.

A)meta symbols

Special single-character codes used by the PROMPT command to

represent complex actions or sequences to be included in the DOS

prompt.

A)microfloppy diskette

The 3-inch diskette format used in the new PS/2 and many other

computers.

A)modem

A device that transmits digital data in tones over a phone line.

A)monitor

The device used to display images; a display screen.

A)monochrome

Using two colors only: the background and foreground.

A)mouse

A device that moves the screen cursor by means of a hand-held

apparatus moved along a surface such as a desk. The computer can

tell how far and in which direction the mouse is being moved.

A)multitasking

When two or more computing applications are executing

simultaneously.

A)national language-support operations

The DOS 3.3 feature that supports displays and printers, using a

new range of code and character groupings.

A)network

Several computers, connected together, that can share common data

files and peripheral devices.

A)nibble

Four bits, or half a byte.

A)octal

A numbering system in base 8.

A)operating system

See DOS.

A)overlay files

Files containing additional command and control information for

sophisticated and complex programs. An overlay file is usually

too large to fit into memory along with the main .EXE or .COM

file.

A)overwriting

Typing new data over what is already there.

A)parallel communications

Data transmission in which several bits can be transferred or

processed at one time.

A)parameter

An extra bit of information, specified with a command, that

determines how the command executes.

A)parity bit

The bit, added to the end of a stream of data bits, that makes

the total of the data bits and the parity bits odd or even.

A)partition

The section of a hard disk that contains an operating system.

There can be at most four partitions on one hard disk.

A)Pascal

A programming language used mainly in computer science.

A)password

A sequence of characters that allows entry into a restricted

system or program.

A)path

The list of disks and directories that DOS will search through to

find a command file ending in .COM, .BAT, or .EXE.

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

[For related topics, press R]

SEE ALSO

directory

directory tree

file

subdirectory

A)peripheral

Any physical device connected to the computer.

A)piping

Redirecting the input or output of one program or command to

another program or command.

A)pixel

The smallest unit of display on a video monitor- -in short, a

dot- -that can be illuminated to create text or graphics images.

A)platter

The rigid disk used in a hard disk drive.

A)plotter

A device that draws data on paper with a mechanical arm.

A)port

A doorway through which the computer can access external devices.

A)primary DOS partition

Up to the first 32 megabytes of a hard disk. Contains the boot

record and other DOS information files.

A)printer

A device that outputs data onto paper using pins (dot matrix), a

daisy wheel, ink jets, laser imaging, and so on.

A)public domain

Something not copyrighted or patented. Public domain software can

be used and copied without infringing on anyone's rights.

A)queue

A series of files waiting in line to be printed.

A)RAM

Random Access Memory. The part of the computer's memory to which

you have access; stores programs and data while the computer is

on.

A)RAM disk

An area of RAM that acts as if it were a disk drive. All data in

this area of memory is lost when the computer is turned off or

warm booted. Also known as a virtual disk.

A)range

A contiguous series of values (minimum to maximum, first to last,

and so on).

A)read-after-write verification

An extra level of validity checking, invoked with the VERIFY

command or the /V switch. Rereads data after writing it to disk,

comparing the written data to the original information.

A)read-only status

Indicates that a file cannot be updated but can be read.

A)read/write bit

The bit in a file specification that indicates whether a file can

accept changes or deletions, or can only be accessed for reading.

A)redirection

Causing output from one program or device to be routed to another

program or device.

A)REM statement

A line in a BASIC program containing remarks or comments for

program explanation or clarification.

A)reserved names

Specific words, in a programming language or operating system,

that should not be used in any other application context.

A)resident commands

Commands located in random access memory.

A)resource allocation

Making system facilities available to individual users or

programs.

A)reverse video

Black letters on a white background.

A)ROM

Read-Only Memory. The section of memory that you can only read

from. This contains the basic computer operating system and

system routines.

A)root directory

The first directory on any disk.

A)scan code

The hardware code representing a key pressed on a keyboard.

Converted by a keyboard driver into an ASCII code for use by DOS

and application programs.

A)scrolling

What the screen does when you're at the bottom of it and press

Return- -all of the lines roll up.

A)secondary command processor

A second copy of COMMAND.COM, invoked either to run a batch file

or to provide a new context for subsequent DOS commands.

A)sector

A division of a disk track; usually, 512 bytes.

A)serial communications

Data transmission in which data is transferred and processed one

bit at a time. Also known as asynchronous communications.

A)shareware

Public domain software. See also public domain.

A)snapshot program

A program used in debugging to store the status of system or

application program variables.

A)software

The programs and instruction sets that operate the computer.

A)software interrupt

A signal from a software program that calls up a routine that is

resident in the computer's basic programming. Also, a software

signal to the computer that the software program has finished,

has a problem, and so on.

A)source

The location containing the original data, files, or other

information to be used in a DOS command.

A)spooling

Simultaneous Peripheral Operations On-Line. Using a high-speed

disk to store input to or output from low-speed peripheral

devices while the CPU does other tasks.

A)spreadsheet program

An electronic version of an accountant's spreadsheet; when one

value changes, all other values based on that value are updated

instantly.

A)start bit

The bit sent at the beginning of a data stream to indicate that

data bits follow.

A)stop bit

The bit sent after the data bits, indicating that no more data

bits follow.

A)string

A series of characters.

A)subcommands

Several special commands used only within batch files.

A)subdirectory

A directory contained within another directory or subdirectory.

Technically, all directories other than the root directory are

subdirectories.

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

[For related topics, press R]

SEE ALSO

directory

directory tree

file

path

A)switch

A parameter included in DOS commands, usually preceded by the

slash (/) symbol, that clarifies or modifies the action of the

command.

A)synchronization

The coordination of a sending and receiving device, so that both

simultaneously send and receive data at the same rate.

A)system disk

A disk containing the necessary DOS files for system booting.

A)text mode

The mode in which standard characters can be displayed on a

monitor.

A)time slice

The smallest unit of time managed and assigned by the operating

system to programs and other processing activities.

A)toggle

A switch or command that reverses a value from off to on, or from

on to off.

A)track

A circular stream of data on the disk. Similar to a track on a

record, only not spiraling.

A)transient command

A command whose procedures are read from the disk into memory,

executed from memory, and then erased from memory when finished.

A)utility

A supplemental routine or program designed to carry out a

specific operation, usually to modify the system environment or

perform housekeeping tasks.

A)variable parameter

A named element, following a command, that acts as a placeholder;

when you issue the command, you replace the variable parameter

with the actual value you want to use.

A)verbose listing

A listing of all files and subdirectories contained on the disk

and path specified in the command. Activated by the CHKDSK

command with the /V switch.

A)vertical portrait

The conventional 8-by-11-inch output for printed information,

with the long side of the paper positioned vertically.

A)virtual disk

See RAM disk.

A)volume label

A name, consisting of up to 11 characters, that can be assigned

to any disk during a FORMAT operation or after formatting with

the LABEL command.

A)warm booting

Resetting the computer using the Ctrl-Alt-Del key combination.

See bootstrapping.

A)wide directory listing

An alternate output format that lists four columns of file names.

A)wildcards

Characters used to represent any other characters. In DOS, * and

? are the only wildcard symbols.

A)word processor

A computerized typewriter. Allows the correction and reformatting

of documents before they are printed.

A)write-protection

Giving a disk read-only status by covering the write-protect

notch.

A)Character Sets

Just as you use an alphabet and a decimal numbering system,

the computer uses its own character and numbering system. DOS

maintains, in memory, all of the characters of the English

alphabet, including numbers and symbols, as well as some foreign

symbols (such as accented vowels). This group of symbols is

called a character set. By changing the symbols in this set, you

can obtain completely new character sets. This is especially

useful for people living in other countries, who have less daily

need of U.S. standard characters and who would rather work with

their own characters.

ASCII Codes

A character is any letter, number, punctuation symbol, or

graphics symbol. In other words, it is anything that can be

displayed on a video screen or printed on a printer.

Each character in a character set has a number assigned to

it, which is how the computer refers to the various characters in

the set. For example, code 65 refers to a capital A, and code 97

refers to a lowercase a. These codes are called ASCII codes

(pronounced ``ask-ee codes''); ASCII stands for American Standard

Code for Information Interchange.

Codes 0 through 31 are used as control codes. Displaying one

of these codes will cause something to happen instead of causing

a symbol to be displayed. For example, displaying code 7 will

result in the computer's bell or beeper being sounded. Displaying

code 13 will result in a carriage return.

Codes 32 through 127 are ASCII character codes for numbers,

letters, and all punctuation marks and symbols. Codes 128 through

255, known as extended ASCII codes, vary from computer to

computer. They usually comprise foreign characters, Greek and

mathematical symbols, and graphics characters. (Graphics

characters consist of small lines and curves that can be used to

create geometric patterns.)

DOS 3.3 has several available ASCII tables, called code

pages. The most common is the standard U.S. code page; the next

most common is the Multilingual code page.

Mapping Character Sets

Any device that displays characters has a device driver that

literally drives, or controls, the device. When the computer

tells a printer to print the letter A, DOS sends the code 65 to

the printer driver, which converts the 65 into a series of

control codes that will print the A.

For the sake of consistency, computers, printers, and

displays all have the same character sets and coding system for

ASCII codes 32 through 127. This ensures that when you press a

key, the desired character will be displayed, and the same

character will be printed by your printer.

The process of matching ASCII codes against characters in a

character set is called mapping.

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

[For related topics, press R]

SEE ALSO

Numbering Systems

A)Numbering Systems

Computers use a variety of numbering systems to operate. The

most basic numbering system is the binary system, in which there

are only two digits, 0 and 1. The digital circuitry used in

computers operates by using small voltages that turn magnetic

bits on or off. Therefore, 0 and 1 are used to represent the two

states of off and on, respectively.

Counting in binary is not difficult, but it does require

some adjustment from the standard decimal-numbering scheme. The

progression of numbers and their matching decimal conversions are

shown in the table below.

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

Binary Decimal

0 0

1 1

10 2

11 3

100 4

101 5

110 6

111 7

1000 8

1001 9

1010 10

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

The general rule for converting numbers from binary to

decimal is to multiply the number in every binary number column

by 2 raised to the column-number power. You count column numbers

from the right, starting with 0. For the binary number 1101, for

example, you would obtain

(1x20)+(0x21)+(1x22)+(1x23)

where any number to the 0 power (20 in this case) is defined as

equal to 1. This is called counting in base 2.

The decimal system counts in base 10. Using the same method

of converting binary numbers, you can see that breaking down the

decimal number 2014 into its component parts works like this:

(4x100)+(1x101)+(0x102)+(2x103)

=4+10+000+2000

=2014

Another numbering system is called octal, or base 8. This system

has only eight digits, 0 to 7. The octal number 701 is converted

to base 10 (decimal) by the following computation:

(1x80)+(0x81)+(7x82)

=1+0+448

=449

The last major numbering system in computers is called

hexadecimal, which counts in base 16. This system has 16 digits

in it: 0 to 9 and A to F, which form the counting sequence

0123456789ABCDEF. To count in this system, you use the same

method you use for other numbering systems. The hexadecimal

number BA7 translates to decimal as

(7x160)+x161)+(Bx162)

which is equal to

7+(10x161)+(11x162)

which is also equal to

7+160+2816

=2983

The table below demonstrates how to count in hexadecimal.

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

Hexadecimal Decimal

0 0

. .

. .

9 9

A 10

B 11

. .

. .

F 15

10 16

. .

. .

1A 26

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

Hexadecimal notation is convenient for byte values because a

hexadecimal digit is equivalent to 4 (24=16) binary digits

(called a nibble) and there are 8 bits (28=256-character set) in

a byte. A byte can therefore be represented by two hexadecimal

digits.

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

[For related topics, press R]

SEE ALSO

Character Sets

A)AUTOEXEC.BAT File

You can create a special batch file, named AUTOEXEC.BAT,

which contains all of the DOS commands that you wish to have

invoked every time you start your computer. The command

statements in the AUTOEXEC.BAT file often include such DOS

commands as DATE, TIME, PROMPT, PATH, and SET. These can also

include commands that execute special RAM-resident programs such

as Lightning or SideKick or a menu program of your own design.

Such a program would allow you to start up specific application

programs available on your PC- -dBASE III PLUS, Lotus 1-2-3, or

WordPerfect, for example.

Every time you start your computer, DOS checks for the

presence of the AUTOEXEC.BAT file on either the disk in drive A

if you are using a two-floppy disk system, or in the root

directory of drive C if you are using a hard disk system. If DOS

locates such a file, it automatically executes the statements it

contains upon completion of the boot sequence.

When you create the AUTOEXEC.BAT file, remember to include

the DATE and TIME commands along with the other commands you wish

executed each time you start the computer. (If your computer is

equipped with a clock/calendar card, enter the appropriate

commands to have the date and time read.) If you do not add

these commands, DOS will no longer prompt you for the current

date and time as part of the start-up procedure and, as a result,

the files you create with your application programs will not be

stamped with the correct date and time.

Consider the following example created with the COPY command

and containing a sampling of DOS commands typically used in the

AUTOEXEC.BAT file:

COPY CON AUTOEXEC.BAT

DATE

TIME

PROMPT $p$g

PATH = C:\;C:\DOS;C:\BATCH

Ctrl-Z

After creating this AUTOEXEC.BAT file, when you start your

computer DOS will first prompt you to update the date and time.

Once you have responded to these commands, DOS changes the prompt

so that it always displays the current directory, and then sets

the path so that it will check the root, \DOS, and \BAT

directories for any command that you enter, regardless of which

directory you are in at the time.

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

[For related topics, press R]

SEE ALSO

Batch Files

Creation of Batch Files

Displaying of Text with Batch Files

ECHO batch file command

Replaceable Parameters in Batch Files

Loops in Batch Files

Conditional Processing

Chaining of Batch Files

Subroutines for Batch Files

PATH Command

PRINT Command

SET Command

A)Displaying of Text with Batch Files

The batch files that you create can contain messages that

are displayed to alert the user to the underlying purpose of the

batch file or to prompt the user to take a particular step- -such

as changing data disks- -during a pause in the execution of a

command. You can also add messages that are displayed as part of

the ECHO command, which controls whether the command statements

entered in the batch file are displayed to the user as they are

executed by DOS.

REM Command

One way to have text displayed on the screen during the

execution of a batch command is with the use of the REM (remark)

command

REM remark

where

remark Specifies the comment to be added to a

batch file.

DOS will not try to execute a REM command, although it will

display REM and the text that follows it on the screen unless it

has previously executed an ECHO OFF statement (see Using the ECHO

Command, which follows).

You can use the REM command to add messages to the batch

file that help make clear its function and procedure. If you wish

to add a nonprinting comment whose purpose is to document the use

of particular commands in your batch file but that is never to be

displayed on the screen to the user, you simply preface the text

of this type of comment with a colon, as in:

:Start backup

Comments prefaced with a colon will appear when you use the TYPE

command to display the contents of the batch file on your screen,

or when you use the COPY or PRINT command to obtain a printout.

PAUSE

You can also have messages displayed on the screen during a

pause in the execution of batch file commands. The syntax for the

PAUSE command is

PAUSE [message]

where

[message] Specifies the message you want to have

displayed on the screen when PAUSE is

invoked.

When DOS encounters a PAUSE statement, it pauses the

execution of the commands in the batch file and displays your

message on the screen, followed by its own message

Strike a key when ready. . .

on the line below. If you enter the PAUSE command without any

message text, you will see only this DOS message instructing you

to strike a key to continue the execution of the batch file.

When you use the PAUSE command, the word PAUSE is always

displayed on the screen along with the message you have entered

(just as when using the REM command). If the batch file has

executed an ECHO OFF command before it encounters your PAUSE

command, neither the word PAUSE nor the text of your message will

be displayed on the screen. Only the DOS message about striking a

key to continue will be visible (see Using the ECHO batch file command,

which follows).

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

[For related topics, press R]

SEE ALSO

Batch Files

Creation of Batch Files

AUTOEXEC.BAT File

Displaying of Text with Batch Files

ECHO batch file command

Replaceable Parameters in Batch Files

Loops in Batch Files

Conditional Processing

Chaining of Batch Files

Subroutines for Batch Files

PRINT Command

TYPE Command

A)ECHO

When DOS executes the commands in a batch file, it can

display each command statement on the screen as it is executed.

You can enter the ECHO command in the batch file to control

whether the command statements are displayed. The syntax is

ECHO [OFF]

or

ECHO [ON]

where

OFF Suppresses the display of command

statements during the execution.

ON Used if you wish to have subsequent

commands displayed on the screen during

the execution of the batch file.

Note that if you enter the ECHO command in a batch file (or

at the DOS prompt) without using either the ON or OFF parameters,

DOS responds by displaying the current state of the ECHO command.

You will see either ECHO is on or ECHO is off.

If you are using DOS 3.3, you can also suppress the display

of a command statement in the batch file by prefacing it with the

@ symbol. For example, entering

@VERIFY ON

will prevent the VERIFY ON command from being displayed. However,

each command statement that you wish to suppress must be prefaced

by an @ symbol. If you use @ECHO OFF, the ECHO OFF command as

well as all subsequent statements are automatically suppressed

until an ECHO ON command occurs.

When ECHO is off, only the display of the command statements

in the batch file will be suppressed. DOS will continue to

display any message that is normally shown after a particular

commandhas been processed. For instance, if your batch file

contains the statement

ECHO OFF

followed by a command to copy a particular file from one

directory to another, you will still see the DOS message

1 File(s) copied

although you will not see the contents of the COPY command itself

on the line above it. Note that you can often get rid of these

messages by redirecting output to NUL:

COPY *.* A: NUL

You can use the ECHO command to display messages to the

user. First, set ECHO to off. Then, enter an ECHO command

followed by at least one space and the text of your message. When

you use the ECHO command in this way, only your message is

displayed onthe screen. DOS does not include the command word

(ECHO) as it does when displaying messages with the REM or PAUSE

commands.

For example, you could have your batch file display a prompt

to insert a data disk in drive A by using the ECHO and PAUSE

commands as follows:

ECHO OFF

.

.

.

ECHO Insert data disk in drive A

PAUSE

When the batch file executes these last two commands, you see

only

Insert data disk in drive A

Strike a key when ready. . .

on the screen. ECHO does not appear along with the prompt

message, but the separate PAUSE command causes the Strike a key

when ready. . . message to be displayed.

When you use the ECHO command to display messages and

prompts, be sure that it is preceded by an ECHO OFF statement (or

an @ symbol if you are using DOS 3.3) in the batch file.

Otherwise, you will see the ECHO command statement containing the

message as well as the message itself when the batch file is run.

Note that the use of the REM, PAUSE, and ECHO commands to

display on-screen messages slows down the execution of the batch

file appreciably. If you need to include extensive instructions

for a particular batch file, use the TYPE command to have them

displayed on the screen.

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

[For related topics, press R]

SEE ALSO

Batch Files

Creation of Batch Files

AUTOEXEC.BAT File

Displaying of Text with Batch Files

Replaceable Parameters in Batch Files

Loops in Batch Files

Conditional Processing

Chaining of Batch Files

Subroutines for Batch Files

COPY Command

A)Replaceable Parameters in Batch Files

You can define parameters (or arguments) that are passed to

particular command statements in a batch file with the use of

replaceable or dummy parameters. This makes the batch file more

flexible because you get to define the arguments to be passed to

the command statements at the time you execute the batch file.

You can define up to ten different replaceable parameters to

be used in a batch file. Each one is given a number between 0 and

9 preceded by the percent sign, as in %1, %2, and so on. Note,

however, that the replaceable parameter %0 represents a special

case: it is always replaced with the file name of the batch file.

The other nine replaceable parameters have no such fixed

replacements: you can make then stand for DOS commands, file

names, parts of file names (such as extensions), directory paths,

and the like. For instance, you could use replaceable parameters

to create a batch file named WHEREIS.BAT that locates a

particular file for you. This batch file contains only a single

command statement using the replaceable argument, as follows:

CHKDSK /V | FIND ``%1''

The CHKDSK command with the /V parameter lists all of the files

and subdirectories for the current directory and pipes this

information to the FIND command.

The FIND command contains the replaceable parameter %1. When

you execute the WHEREIS.BAT file, you enter the filename you wish

to locate along with the batch file name. To locatea file called

LOAN.FRM on the hard disk, you run the batch fileby entering

WHEREIS LOAN.FRM

DOS will then execute WHEREIS.BAT as though you had entered

CHKDSK /V|FIND ``LOAN.FRM''

as the command statement. If this file is located in C:\WP\FORMS,

DOS will respond by displaying

C:\WP\FORMS\LOAN.FRM

As you can see, you can use this same batch file to search for

any file or group of files, simply by entering a different file

name at the time you execute it.

In complex batch files, you may find that ten replaceable

parameters are not sufficient. In such a case, you can use the

SHIFT command. SHIFT discards each argument after it has been

acted upon, replacing it with the next argument so that after the

first argument is processed, the second becomes the first, the

third the second, and so on. After you use the SHIFT command, the

0% argument is never acted upon, since the %n argument becomes

the %(n--1) argument. Note that SHIFT is useful in loops, which

are described later in this appendix.

Passing Arguments from the Environment

As noted in the SET reference entry, you can specify a set

of strings that the batch files can refer to. For example, if you

enter the SET command

SET REPORT = YREND

and have previously entered the following command line in a batch

file

COPY %REPORT%.WK1 A:

the batch file will copy the file named YREND.WK1 to the floppy

disk in drive A when the batch file is run.

Note that the replaceable argument in the batch file command

line is enclosed in a pair of percent signs (%). This indicates

to DOS that the argument is to be taken from the environment.

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

[For related topics, press R]

SEE ALSO

Batch Files

Creation of Batch Files

AUTOEXEC.BAT File

Displaying of Text with Batch Files

ECHO batch file command

Replaceable Parameters in Batch Files

Loops in Batch Files

Conditional Processing

Chaining of Batch Files

Subroutines for Batch Files

COPY Command

FIND Command

A)Loops in Batch Files

There are several methods for creating loops in batch files.

If you want the entire batch file to repeat, you can use the %0

replaceable parameter as the last command. You will recall that

%0 is always replaced with the file name of the batch file. When

you add it asthe last statement in a batch file, it causes all of

the commands in thefile to be repeated. For example, if you

create a batch file namedDIRA.BAT that contains the command

statements

ECHO OFF

ECHO Insert new disk in drive A

PAUSE

DIR A:/p

%0

the file will repeatedly prompt you to insert a different disk in

drive A and then give you a directory listing of all of the files

it contains when you press a key to continue. This batch file

will continue to repeat until you press Ctrl-C or Ctrl-Break to

terminate it.

The FOR Loop

To repeat a command within a batch file for a specific

number of cases, you use the FOR command. The syntax for the FOR

command is

FOR %%variable IN (set) DO command

where

command Specifies the command to be executed for

each member listed in the (set)

argument, in the order in which these

members are entered. The command

argument can consist of only a single

command, which can be another batch file

command (except for the FOR command), an

executable program, batch file, or DOS

command. Note that you cannot nest FOR

batch commands, which is why the command

argument cannot contain another FOR

command statement.

set Specifies files to be operated upon.

variable Specifies the variable to be operated on

by the command. Notice that a double

percent sign is entered before the

variable (usually, though not

necessarily, a single letter) to

distinguish it from a replaceable

parameter.

Consider this example using the FOR command:

FOR %%A IN (1985.WK1 1986.WK1 1987.WK1)

DO COPY %%A %2

In this batch file, the FOR command statement copies each of the

three worksheet files listed in the (set) argument to the

directory path entered when the batch file is run by passing it

to the %2 replaceable parameter. Notice that the command argument

in this example is actually COPY %%A, instead of just COPY.

The GOTO Command

You can also cause a batch file to execute (and sometimes

repeat) a group of command statements in the file beginning at a

specific point. To do this, you use the GOTO batch command. You

indicate where in the batch file the commands are to be executed

(or repeated) by using a label.

The syntax of the GOTO command is

GOTO [:]label

where

label Specifies a character string of up to

eight alphanumeric characters, and is

not case-sensitive. By convention,

alphabetic characters are entered in

lowercase and the label name is prefaced

by a colon. Note that the colon is

mandatory before the actual label, but

optional before the argument in the

GOTO. The label, however, cannot contain

a period (.).

When you use the GOTO command, DOS executes all of the

command statements listed below the label until it reaches the

end of the batch file or another GOTO statement telling it to

begin reprocessing the commands or to process a new set of

commands beneath another label.

Looping with the GOTO command can be illustrated by the

following generalized form:

:label

command%1

.

.

.

command%n

SHIFT

GOTO :label

Assuming that the commands listed below the :label contain

replaceable parameters, with the use of the SHIFT batch command,

this loop would be executed indefinitely (until you terminated

the batch file by pressing Ctrl-C or Ctrl-Break).

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

[For related topics, press R]

SEE ALSO

Batch Files

Creation of Batch Files

AUTOEXEC.BAT File

Displaying of Text with Batch Files

ECHO batch file command

Replaceable Parameters in Batch Files

Loops in Batch Files

Conditional Processing

Chaining of Batch Files

Subroutines for Batch Files

A)Conditional Processing

The endless loop illustrated above is of limited use in

batch files. It is much more common to use the GOTO command with

conditional statements. That way, the commmands listed beneath

the label are executed only when the condition is true. Using the

GOTO command with conditions allows you to create batch files

that branch according to the result of the condition.

In addition to using conditional processing to branch, you

can also have command statements executed only when there is

equivalency between two items or if a particular file exists.

The IF Command

The batch IF command is used to allow conditional execution

of command statements. The syntax of the IF command is as

follows:

IF [NOT] condition command

If you wish to have branching occur as a result of the outcome of

the condition, use this form:

IF [NOT] condition GOTO [:]label

There is no ELSE command in the batch file command

vocabulary. If you wish to have the program branch to one set of

commands if the condition is true and another if it is false, use

this form:

IF condition GOTO [:]labela

GOTO [:]labelb

If the condition is true, execution jumps to the commands beneath

label a. If it is false, it jumps to those beneath label b. Note

that you do not have to use the second GOTO statement if the

commands to be executed when the condition is false follow the IF

statement directly.

Testing for Equivalence

The condition argument in an IF command can test for

equivalence between two items. If they are found to be equivalent

(that is, identical in terms of characters and case), then the

command statement listed in the command argument is executed.

When you test for equivalence, you use a double equal sign. The

syntax is as follows:

IF string1==string2 command

Note that strings are case-sensitive.

For example, you could enter the following IF command:

IF %1==December GOTO :endofyr

If you execute this batch file and enter December as the first

replaceable parameter, the batch file will jump to the label

:endofyr and execute the commands that are listed beneath it.

Testing for the Existence of a File

You test for the existence of a particular file as the

condition argument of the IF command. The syntax for this use is

as follows:

IF EXIST [d:][path]filename command

The options are as follows:

command Specifies a command to be executed

only when the file entered for the

d:path filename argument is found

on the drive/directory indicated

(if these parameters are omitted,

then in the current directory).

d:pathfilename Specifies the file to be operated

on.

For example, you might have this IF command statement in a

batch file:

IF EXIST 4QTRTOTL GOTO :yrend

The commands beneath the :yrend label are executed only if DOS

locates the file named 4QTRTOTL in the current directory. If this

file is not found, this GOTO statement is ignored.

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

[For related topics, press R]

SEE ALSO

Batch Files

Creation of Batch Files

AUTOEXEC.BAT File

Displaying of Text with Batch Files

ECHO batch file command

Replaceable Parameters in Batch Files

Loops in Batch Files

Conditional Processing

Chaining of Batch Files

Subroutines for Batch Files

A)Chaining of Batch Files

You can chain batch files by adding the name of the second

batch file to be executed as the last statement in the command

statements of the first batch file. Do not confuse chaining batch

files with calling a new batch file as a subroutine. When

chaining batch files, control does not return to the first batch

file as when using subroutines (see the section on Using

Subroutines, which follows). Because of this, reference to the

second batch file must be entered as the last command statement

in the first batch file. If it is not, the commands below this

reference in the first file will never be executed.

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

[For related topics, press R]

SEE ALSO

Batch Files

Creation of Batch Files

AUTOEXEC.BAT File

Displaying of Text with Batch Files

ECHO batch file command

Replaceable Parameters in Batch Files

Loops in Batch Files

Conditional Processing

Subroutines for Batch Files

A)Subroutines for Batch Files

To execute a second batch file as a subroutine (that is,

have control returned to the first batch file upon execution of

all command statements in the second file), you must load a

second copy of the command processor, using the COMMAND command.

The syntax is

COMMAND /C batch

where

/C Tells DOS that this a secondary copy of

the command processor.

batch Specifies the batch file you wish to

call as a subroutine.

To have control return to the first batch file and to have

the secondary copy of the command processor unloaded, the EXIT

command must be the last statement in the batch file used as a

subroutine. If you do not place EXIT as the last command

statement in the called batch file, control will not return to

the calling batch file and the secondary copy of the command

processor will continue to run.

Using The CALL Command

DOS 3.3 has added a CALL command that allows you to call a

second batch file as a subroutine (that is, execute the commands

in a second batch file without terminating the first batch file).

This command can be used in place of the COMMAND and EXIT

commands.

The syntax of the CALL command is

CALL [d:][path]filename

where

d:pathfilename Specifies the name of the

batch file to be called. When

entering this file name, do

not include the .BAT file

extension.

You can use the CALL command to call its own batch file.

However, you need to provide a method whereby the batch file is

eventually terminated.

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

[For related topics, press R]

SEE ALSO

Batch Files

Creation of Batch Files

AUTOEXEC.BAT File

Displaying of Text with Batch Files

ECHO batch file command

Replaceable Parameters in Batch Files

Loops in Batch Files

Conditional Processing

Chaining of Batch Files

COMMAND Command