Sei sulla pagina 1di 130

MS_DOS

Version ,2.11
Advanced User's Guide

~1""'111~1 equipment """"""""'I""""""'I~II!""""'I


_~~~llllrl~lL October 1984
CONTENTS

CHAPTER D RECTORIES AND PATHS


DIRECTORIES
ILENAMES AND
Pathna_e.
Path ng and Externa
Pathing and I
Di ayi Your
CreatingD
How

CHAPTER BATCH
BATCH PROCESSI
THE AUTO EXEC BAT F
2. How to an
2.3 CREATING FI
2. .BAT

CHAPTER REDIRECT ON INPUT AND


I NPUTAND 'OUTPUT
Red Your
3 1. F 1
Command P p ng

4 ADVANCE:D MS-DOS COMMANDS


4. COMMAND
4.2 MS-DOS ADVANCED COMMANDS
FIGURES
-1 A e Hierarch cal Structure
1 MS-DOS Batch F e
2-2 How MS-DOS Uses the AUTOEXEC.BAT e
The MS-LINK ion
How I Divided

TABLES
".- MS-DOS .Advanced Co_ands It-2
"'-2 SORT Table

v
is guide
ng
1ed i ."'lIIl"."."
commands.
is guide assumes you have:

o
The . . . . . . . . . . . . . . . . . . . . . . . . . . . . . --.. . . ."""'"'"' . . . ~~ . . . .
organ

and

2 D batch ng

Discusses red rect on

1 ins the MS-DOS commands


used programmer

5 o the FILE COMPARISON uti

6 Discusses the LINK uti i


IInl''''.'''I" i x A you how to configure
ing for the Rai

vi i
01

Th s discusses
how to file names
structure.

1 1 DI

In
d
director i
thees
way of d

1-
D RECTOR I AND PATH'S

For example. you may want all of your ing programs in


one di and text files in another. Anyone di
can contain any 1e number of files. and t may also
contain other directories to as subdirectori
is izing your f les is called a
hierarchical di structure.

A hierarch ca d structure can be of as a


II structure: directories are branches of the tree and
f i 1es are 1eaves. the II grows downiward;
that is. the II The root s the first
level in the di t the d that
is automatically created when you format a disk and star
ing f les in it You can create addtt onal director es
and subdirectories with some of the commands discussed n
4,
The tree or f structure as you create new
director groups of f les or for other people on the
each new d , files can be added, or
es can be created.

It is poss ble for you to Utravel ll around


instance it i pass b e to ind any fi
start at the root and traveling down any of the branches
to the desired file. Conversely, can start where you
are withi the fil system and travel towards the root.

Un ess ilion create a file, new


f les in the di which you are now
working. Users can have f 1 of the same name that are
unrel!ated because each i in di ferent direc

i gure 11 i 11 ustrates ica hierarchical di--~-~~_u


structure.
DI

F g'ure 1 1: A e H erarchi

1. A
N
01
D

1.2.

mp
ona
an
names
prev

ts

Ind
DI

lA fu 1 This one
be file named lA in the
named bel ng to the
named MARY.

A
or
of the
working
t

TEXT Name of a d i __ I ..........' . . . . .


in the
work ng di

uses th shorthand notation to


the name the working di
hierarchical d 1 st ngs.
automatically creates thi* when a d
i made.

The shorthand name the worki ng d i ...A~ ...... , ........ 'Il1 S


di -.1 "
you

DI R

ist the fi 1es in the


work di .. _".....'.. . _.. "

DIR

1 i st files in the -_1.. -...,. . 1 S


R

R
b
s ow.

into

DIR
d

4 Di

CHDI

you will

A:
dr desi on
DI A.ND

If you now want to see what is in the di


you can ssue the command DIR. The following
exam.ple of the d splay you mi receive rom the
command a subd i .. _~..... "".... ,,'

drive D
of A:

<DIR> 10:
IR> 10:
<D R> 10:
ILEl COM 9:
4 free

for th disk was ass when the disk was


Note that MS-DOS 1i both fi es and
rectories As you can sea, Joe has another
d in named TEXT The I I
ndicates the work , and
the thand di ER.
ILE sal A of
these directories and reside on ve A:

Because 1 and es
previous displ MS-DOS you to g
i "'_~""'i/I!l"''' the same name as a
example, you have
you cannot create

1.2.5 Creat ng a D rec

your work ng direc


i ,use the
command. For examp e to t

NEWDIR under your working di

MKDIR NEWDIR

110
DI

.2 to D

You
to

.2.7 to

To
the

RMD R
R
2

This

then
f
the same
a common

2. 1

a batch
the COpy
.BAT F
on usng create

2-1
NG

Two are ava 1 1e use expressly in batch


f i 1es: and
REM REM perm ts you to inc uderemarks
and comments in your batch fi es without these remarks be ng
executed as commands. you wi than i ona 1
and its you to ither continue or abort the
batch process at given point REM and are descr bed
n detail 4.
Batch process ng is useful f you want to execute several
commands w th one command, such as when you
format and check a new disk. example, a batch f le for
this mi look like this:
1: Th i i fi1 check new d sks
REM It s named NEWDISK.BAT
3: Insert new disk n drive B:
4:
5
6: B:
To execute th .BAT file, simp1 fi l-"''''ilOorT1Ii'''''

the .BAT extension:

NEWD
The result is the same as if each of the lines in the BAT
f 1e was at the termina as individual commands.
Fi 2-1 ill used wri
and execute an batch fi le.

2-2
F
4. press wh 1 n batch mode, th
appears

nal batch

the
f the

ends
command n

command n batch i1 be the of


another batch f i 1lows you toca11 one
file from another when the first i nished.
2.2 F

11
MS-DOS ime
and date
AUTOEXEC. BAT are

Figure 2-2: How I-\S Uses the AUTOEXEC.BAT File


2 .1 e

If,
run
cou
.3 A FI WI

i e cop ed
A>

The wh cons of now


res n the default dr vee
can
lin
if you than 10

2. the as part a
! you must t
examp e to speci the fIe
you must it as in, the

2.3 1 Executing a .BAT F le


To execute the batch i e MYF LE.BAT the
that will replace the ,you must
enter f ename ithout its fo 11 owed
you want MS-DOS to for
etc.

Remember that the fil MYFILE BAT consists 3 Ii nes:

.MAC

execute the MYF LE batch

MYF A 1B

MYFILE s substituted for A PROGl


for

10
The the

MYFI
3-

3- 1

1
ION INPUT AND

in your command. For example. the


command

DR

the disk in defaul

to a file named
MYF file on the command line

DI R>MYF I

does creates
your di If MYFILES
overwr Ie
new data
your di or f e another
rep1 ing the entire two
can be used to tel
command a
the end of iedile. The command

D R

to currently ex
not exist. t s
to have
from
using a less-than
command
>LI

and sor a f Je
3.1 2 Fi1

A fi 1teri
in sOlIe
or to a fi
i 1.. ",,a#lll11l'1I

textn f

di t,

text
can n on

3.1.3 ip
Piping is p
() For

IREC

MORE

one screen
your

You p Iter
tOflY'lANIJS

sts the
to use
commands " and

The fo low notat on ndicates how you d format the


advanced commands:
1. You must enter any words
are call k
You
,of

2. the text for tems enc osed n angle


For example, you should enter the
en 1 is shown in

3- n square brackets ([ ) ional If


wish to i i ona i _",;/1,, _ on, do not
1 e the square brackets, only nformation
thin the brackets.
ADVANCED COMANDS

It. An ell i i s ( ) i nd i you an


item as ma:ny t imies as you want.
S. must include all .... ionwhere shown (with
the exception square ,suches connas'i
1 signs, question t colons, or slashes.

ADVANCED COMANDS
Table lists the

Ie 1: Advanced

Connand

BREAK check

IR directories; pri di

console

batch file echo feature


IN Converts executable files to format
EXIT its command and returns to lower level

FIND a constant ng of text


i 11 i 1i
f i 1es

Prey flow control for bateh fi


IF flow contr'ol files
E -_.,or_t one t

a COIllniina

~U:lIDt.nall .... 'n ............. ion a f i 1e

f or
f

FT

or DatCk,,,ar'G
Interna

CTRL-C

BREAK

OFF sw liS-DOS
BREAK.
TYPE
IR DI Internal

SYNONYM
CD

a d fferent d splays current

SYNTAX
CHDIR

want
as

and you in the new d A


shor is also avai able with this command:

IR

This wi 11 always n the


di "fI1I!!!J&/I- 'P!IfI";.... "I of your working di
COMMANDS

CHDIR used without a displays


di If your working di is
on dr i ve ,8: t you IR <Return>,
displa,y:
NAKE

All which you issue

SYNTAX
CTTY ice>

COMENTS
The i are giving
is useful f you want
to you are wo,rk i The

AUX

moves all the current


devi the AUX such as a
pr i The cOIIRIand
CON
to the original ee the
NAME TYPE
'I nterna1

PURPOSE
Turns batch echo on and off.

SYNTA.X

ECHO IOFFI

COMMENTS
comm,ands ina batch f il e are displ
on the console when are seen by the
command processor. OFF turns off this feature.
ECHO ON turns the echo on.
If ON or OFF are not specified, the current setting is
displayed.
f i lei to format.
a saving of d sk faster

SYNTAX

N <d:><fi ename><.ext> :]

only f want to convert. .EXE


format The e named espec s
f no extension is if edt it
The i fe converted to .COM
ile of the and aced in
the If you do not spec a vet the
Ive f i 1e wi 1 be used .. If you do not
speci f il ename, the f i 1ename wi 11 be
used., a f lename extension in
the the new file w 1 be g ven an

The i file must be n va id .fXE format


the 1i The res i dent ,or aetua 1 code and data par t
t

the file must be less than There must be no


STACK
k of are tlel~,e"ltl i ng
whether the initial CS: P ~e':Jmt!!nt: I ns t ruet i on
I is specif ed in the.

:IP s not specif ed in the. 1e,a pure


binary conversion i assumed. fixups
necessary (e. the conta n's
ons requ relocati you
for ixup value. This
at which the program s to
ng program wi1 be usabl
the abs01 memory address
ion. The command
properly oad ng

COM programs
1i

f EXE2BIN inds error. or more fo 11 ow


ror messages will be displ

cannot be conver
CS: P do,es not meet either of criteria
specified above, or t meets the .COM f Ie
criterion but has xups. This message is
also displ if the file is not val d
executable fil

10
File

file is not on the di i f i ed.

is to run N.

File ion error

IN cannot create the f le. Run


ne i the d is fu , or f some
condition caused the error.

icient disk
s not disk to create a new
Ie.

-base
source (. conta ned nformation
i ca.t i ng that a is required for the
1e i at
ich the fini

i 1e be conyer ted

fi e is not in the correct format.

- Read error on f Ie
read less than size n header
is is a warning y.
COHl-tANDS

NAME

IT Internal

PURPOSE

Ex ts command
and returns to a previous level, if one exists.

IT

This command can be used when you are running an


applicat on and want to start the MS-DOS
command processor, then return to your program. For
examp e, to look at a di on drive B: whi e
running an app icat on program, you must start the
comman,d' processor ng COMMAND i n response to the
default drive

You can now D R command and will


d splay the di for the default disk. When you
EXIT, you return to the previous level
a.ppl ication

12
FIND

a specific string text n a f e or


files.

SYNTAX

FIND <stri i lename

FIND a filter that as ions a str ng and a


of filenames It wil1di 81 lines that
a spec fistri from f i 1es if i ed i n
J ne.

If no files are specified. FIND 1 take the i on


the and display all lines conta n the
specified string.
for FIND are:
FI to di a 1 Ii nes not
containing the ifled str ng.
FI to int only the count lines
contained a match In of the files.
each line to be its
ve line number n the

3
ADVANCED COMMANDS

string should be enc1 in quotes. Example:

FIND IS BOOK1 BOOK2

displ all ines from BOOK1.TXT and BOOK2.TXT (in


that that contain the string IIFoolls Paradise

The command
DIR B: I FIND IV IIDATII

causes MS-DOS to display all names of the f les on the


disk in drive B: wh ch do not n the stri OAT.
double around a stri that a1 has
in it.
When an error is detected, FIND responds with one of
the following error messages:
Incorrect version
FIND will only run on versions of that are
2.0 or hi

F ND: Invalid number of


You did not speci a string issui the FIND
command.

FIND: error
You an illegal string when issuing the FIND
command.
FINO: Fi 1e not <filename>
filena.e you ified not 5t or
ND cannot find it.

FIND: error in <filename>


error when FI tried to, ,read the fi 1e
ified

FIND: I nva 1 d ion-name>


specif edan ion that not st.

5
ADVANCED MS-DOS COMMANDS

NAME
FOR Internal

PURPOSE
Command extension used in batch and interactive file
......",....... i ng.

SYNTAX
F IN <set> DO <command> - for batch processing
FOR IN <set> <comm,and> for interactive
processing.

COHI1.ENTS

<c> can be any character 0,1,2,3, ,9 to avoid


confusion with the %0-%9 batch

<set> is

The var i ab 1, e i s set se.quen.t i a lly to each member


of <set>, and then <command> is evaluated. If a member
of <set> is an expression involving * and/or 1, then
the variable is set to each matchinig pattern from disk.
In this case, only one such < tem> may be in the set,
and a.ny < item> bes i des the firs tis ignored.

NOTE

The words IN, FOR, and DO must be in uppercase.

16
N ( Ie.)

F IN BAR

only I
would i was an
error throw out the' :1
so that the would never see t. the
is in a then only one should be

17
ADVANCED MS-DO'S COMMANDS

NAME TYPE
GOTO Internal,

PURPOSE
Command extension used in batch file processing.

SYNTAX

GOTO <label>

COMMENTS

GOTO causes commands to be taken from the batch f 1e


beginning with the line after the <label> definition.
If no label has been defined, the current batch file
w 11 terminate.
Example:

:foo
REM looping
GOTO foo
wi 11 an Infinite sequence of messages: REM
looping
Start ng a line in a batch f 1e with I:' causes the
line to be ignored by batch processing. The characters
following GOTO define a label, but this procedure may
also be used to put in comment lines.

18
NAME

in. f 1e

1 F t i oh> <command>

The <eond tion> soneof the following:


<number>
i and only if the ous executed
CO NO had an exi code of <number> or
<stri <stri
f and only are
ieal after Stri ngs,
not have
E,X I i 1ename>
f and onl y i f <f il enam!.> ex s ts

tion>
if and only if ition> is false.
The IF statement 110ws condiional execution of
When the <condition> s true then the
is executed. se, the <command> is

19
ADVANCED MS-DOS COMMANDS

NOTE
The words ERRORLEVEL t EX I ST t and N'OT must be
uppercase.

Examples:

IF NOT EXI FOO ECHO Can't find file


IF NOT ERRORLEVEL3 LINK. S1, I ;
NAME

PURPOSE
The to
2. 11 l!oader on
disk is a
of the
places

SYNTAX

nationdrv:>

ination ve is ve or hard
ive that you want to oader on.
ace the 1 on asketteor a hard disk
ion that contains f les.
eop ies the 1aader and 188V'8S the f i 1 es

The 11 owi ng aces the on 2.11


1 on the drive E.
E:
COMANDS

NAME

MEDI

access to diskettes

MEDIACHK

The Rainbow can read a var of


d skette formats. The must first read the
disket to determi the MS-DOS format If
you use only Ra nbow, di use
the MED ACHK command to that
you always use is

When you the MED ACHK command with the OFF swi
Rainbow no longer checks to determine the
d skette1s fo~mat. This the
access to the

The default is IACHK


HAKE

I4KDR Internal

SYNONYM
KD

",akes,. new di ..........,.......


1

KKD R

is to create a h erarch cal


When you are In your root d
rector es using

IR

create a i .aj"'''''''''''' n your root


To create d i ... j ... IfIIl.......,
ned

IR
COMMANDS

NAME
MORE

PURPOSE

to console one screen at a time.

MORE

s a f Iter that reads from standard i


as a command from your terminal) and displays one
screen of information ime. The MORE command then
pauses and d splays the --MORE message the bottom
of your screen

d ay another screen
on. This continues unti all the
data has been read

The command s useful for viewi a 1 f i 1e one


screen a time. If you

MYF I COM
wi 11 display the f 1e MYFILES.COM the
default dri one screen at a time.
Internal

SYNTAX

PATH

al ows you to which


ld be searched external commands
searches your work d The
s no
d i ....,.......".. ",

d
unt il set another
You can tell one
speci ng several by semicolons.
1et

PATH IN\DEV
tell s the directories specified
above find external commands.
searches the in the order specified in the
PATH command.
The command with no ions will print the current
If you spec i PA.TH; , wi 11 set the NUL
, mean ng that only the work will be
searche,d for externa 1 commands.
nterna)

execut on the f e.

AX

the 'execut on a batch f Ie you need to


d or some other act on.
execut on unti you any

When command processor encounters tpr nts:

ike a when
If press wI be
di
1

If Y in to th s execut
the inder of batch wi be
and wi 1 returned to ng
level. Therefore, used to break a
batch f i 1e into e.ces ,a owi ng you to end the batch
file at an intermed ate pont.
comment is ional may be entered on the same
ine as You may Iso want to the user of
the batch f 1e with some meani the
batch f Ie pauses. For example, you may want to
disks n ~ne of the drives. An ional
may be g yen n such cases. The comment will be
displ the ike message.
NAKE

the

SYNTAX

COMENTS
This the
If no text
will be set default
defau 1t dr i ve ion. Yo,u can
spec as the current using
characters indicated below.
use the command with the ion, be
you spec I an existing dr ve. If you use
ion th a non-ex i stent dr ive" you could see
resu ts.
COMMANDS

The 1ow'i ng be used in the prompt


command to speci They must all be
by a dollar in the prompt command:

To Get This

$ The IS' character


t The current time
d current date
p The current di of the default drive
v version number
n The default drive
g The 1>1 character
1 The Ie character
b I I' character
A CR IF sequence
s A space (leading on1
h A
e

les:

PROMPT
the default drive letter

PROMPT Time $
Sets a two-line prompt which prints:
Time rent time)
Date (current date)
PROMPT [7mSn: [m
the in inverse video mode and
returns to normal video mode for other
text.
a file or an entire disk containing bad

<filename I d:>

If a on a disk s ,you can recover ether


the containing that sector thout the bad
the entire disk (if the bad sector was n

To a part cular file,

<filename>

11 cause to
and to ski the
finds the sector ,the sector
will no onger allocate

To a d sk,

<d:>

where is the letter of the drive contain ng the


disk be recovered.
ADVANCED COMMANDS

I f there i s n,ot room on the root d i ....."",..,...... ""


RECOVER will print a message and store information
about the extra files in the File Allocation Ie.
You can run RECOVER again to regain these files when
there i s more room i n the root d i ".,11liiio"''''''''',".1

NOTE
You should use RECOVER only as a last resort.
could misi data that may not be
Th s could lead to unpredictable
MAKE
REK Internal

OJ are on the salle I ne as the'


e ng execution of that batch
fi 1e.

REM

owed in the comment are the

1: sis afl Ie new disks


2: Itis
Insert
B:
B:
ADVANCED COMI1ANDS

NAM,E TYPE
RMDIR (REMOVE DtRECTORY) Internal

SYNONYM
RD

PURPOSE
Removes a d i ......."" .......... 1 from a hierarchical di .....,'.. JiIIIl.... "'1

structure.

SYNTAX
RMDIR

COMMENTS
Th s command removes a di empty
for the. and shorthand
To remove the d i ....,......"..,...... first issue a
DIR command for that path to ensure the d i --"............ _.. . '
does not contain any important files you do not
want deleted. Then
RMDIR

The d i -_ " has been de 1eted f rom the d i ....,.. '... "" ..""
structure.
NAME

Internal

PURPOS'E

access to.18ore 10 1e in
i1e processing.

SYNTAX

1FT

are imi to hand1 0


allow access to more
to the command

f
%1

then a 1FT w 11 result in the following:


%1

If are more than 10 given on a


1 i ne, those that appear ter the Oth w 11 be
shif one at a time into successive shifts.
NAME
SORT External

PURPOSE
SORT reads input from term; na 1, sorts the d.ata,
then writes it to your terminal screen or fil

SYNTAX
SORT [/+n]

COMMENTS
SORT can be example, to ize a file by
a certain columin. There are two switches which allow
you to select ions:
reverse the sort; that is, sort from Z to A.
sort starting with column n where n is some
number. If you do not specify this switch.
will in sorting from colum'n 1.
reads and sorts in the order described in Table
4-2.
ADVAN'CE.DKS-DOS COMANDS

Examples:

Th i s command will read file UNSORT.TXT. reverse the


sort, and then write the output to a file named
SORT.TXT:

/R <UNSORT.TXT >SORT.TXT

The fol1owi ngcommand will pipe the output of the


di command to the SORT filter. The SORT filter
will sort the di~-~-~~~u listing starting with column 1.4
is is the column in the di list ng that
ins the file si , then send the output to the
console. Thus, the result of this command is a
di sorted by f Ie size:

DIR 4

The command

DIR I SORT 4 HORE

will do the same thing as the command in the previous


example, that the MORE filter will give you a
chance to read the sorted directory one screen at a
time.
5
FI UTI

s descri bies how to use the i e son


uti Ii

ION

It is to files on If
you have e and later want to es to
see which you can use F Ie
i son
...""111..,4

Fi Ie contentl o,f two


f i 1es. f i lei can be
to the f les being
may be les n source
statements or les
the Linker
language cOlRpil
The i sons are miade i none of two ways a
1i I i or a ba I S . The 1i ,,..""'-1 ne
comparison isol blocks lnes that are fferent
between two files and pr nts those blocks of nes. The
eompar son d ays the that are
the two files.
FILE COMPAR I SON UT I L I TY (FC)

5.1.1 Limitations on Comparisons

Fe uses a I arge amount of me.mory as buffer


to hold the source files. If the source files are 1
than available memory, Fe will compare what can be loaded
into the buffer space.

If no lines match in the portions files in the


space, FC wil display only the message:

*** Files are different ***


For binary files larger than available memory, FC compares
both f i 1es comp 1ete y, over 1a.y i ng the port i on in memory with
the next port on from disk. All d fferences are in
the same manner as those files that f tcomp I ete 1y in,
memory.

5.2 FILE SPECIFICATIONS


All file specifications use the fo 1 ng
: ] <f i 1ename>

where: is the letter desi ing a disk drive. If the


drive designation is omitted,. Fe defaults to the
ing 's default drive.

name of the

is a one- to three-character extension to the


lename.
FI IL

5.3 HOW TOFt


is as ows:
Fe [II <filenallle1> i 1. ' l t l l l l l.... ,.

Fe .atehes
I I ..., ltilll'II ,

filenames

FI ~
. . . . ...... IlII". . . 'u of disk dri ve
B: and d
Sineeno dr assumes that
\BARd t ....""" .. IlII"Ii.fLl the It drive.
FI COMPARISON UTILITY (F

5.4 FC SW
There are four switches that you can use with the File
Compar i son Ut i 1 i ty::

/8 a binary comparison of both files. two


files are compared ....".,'......_....,_...,,"' ...'.. , with no to
,.. ...... "n,."'n,.'nni ze ter mi smatches are
printed as follow~:
--&llIIIIIN':."l\----P l----F 2-
xxxxxxxx yy zz

xxxxxxxx is the relative address pair of


from inning of the fil Addresses
start at 00'000000; yy and zz are the mi sm:atched
from fi leI and fi le2, ively. f one of the
files contains Jess data than the other, then a
message is printed out. For example, if filel ends
before f le2, then Fe displays:

***Data eft in Fl***


# stands for a nlumber rom to 9, This tch
specifies the number of ines required to match for
the files to be considered as matching again after a
difference has been found. If this switch is not
specified, it defaults to 3. This switch is used only
in source comparisons.

Causes Fe to compress whites and during


the comparison. Thus, multiple contiguous whites in
any line will be considered as a single white space.
Note that although Fe whites, it does not
ignore them The two are beginning and
end i ng wh i tes i n al i ne, i r i l l ' ,...... ,iIICIlrl
FI

e lin a

11

and

but not match with

This Itch is only n source sons.


the match process to t the case of
1 All letters in the files are considered
uppercase letters. For e,

wi 11

fi ed, then Fe
&IIIRlDe,

11

Thi s tch i s used on y t n source cORIpar so,n,s.


FI UTILITY

5.5 OIF ING

The File ison Utili reports differences between


the two files you speci displ ing first filename,
followed the line,s that differ the files,
I lowed the first line to match in both file's. FC then
displays the name of the second file followed by the lines
that are different, followed the first line that matches.
The default for the number of lines to match between the
files is 3 (If you want to this default, specl
the number of lines with the switch.) For example,

lename >
<difference>
<1st ine to f i I e2 in file >
__,-_.__.. _ .... -c:1'" i ename2>

<difference>
1st line to match file n f il e2>

FC will continue to list each d fference.

If there are too many differences (nvol ng too many


Ii the program wil simp y report that the files are
different and s

If no matches are found after the fi st difference is found,


Fe wi 1 display:

*** Files are different ***


and will return to the default drive prompt
example,
FI III

5.6
two i es, you
unless you red rect
in sam,e

To COinDelre theFC to
DIF

FC Fi F i 1e2

The and miatches betweenFi 1 and F 1 wi be


FER.TXT on the default drive.
FI COMPARISON UTILI

5.7 EXAMPLES

Assume these two I I files are on disk:


ALPHA.ASM, BETA.ASH
FI A FILE B
A A
B B
C C
o G
E H
F I
G J
H 1
I 2
M P
N Q
o R
p S
Q T
R U
S V
T .4
U 5
V w
W X
X y
Y Z
Z

To compare the two files and display the differences on the


term na screeen,
FC ALPHA.ASH BETA.ASH
FI

di 1
screen. A 1 other Its
ere: use tabs,
do. c~IDllrison on the

as follows on the term nal screen

D
E contains
F contains g.
G

M f i1
N contains mno where
o contai'ns J 12.
P

.ASM
J
1
2
P

w f 1e
conta ns w'where
BETAns
it
5
w
F LE COMPAR UTILITY

can pr nt the di on line inter using the


same two source files. In th s example, four successive
ines must be the same to constitute a match.

Fe /~ ALPHA.ASM BETA.ASM >PRN


The folil owi ng will appear on the line printer:

----------ALPHA.ASM
D
E
F
G
H
I
M
N NOTE: p is the 1st of
o a string of ~ matches.
P

----------BETA.ASM
G
H
I
J
1
2
P

------------ALPHA.ASM
W NOTE:w is the 1st of a
------------BETA.ASM string of 4 matches.
!+
5
w
10
FI

forcesa d
on the the salle two
as were used in es

Fe .AS" ASH

The in is e bi i son.
This swi and any the
filenames Fe command fo low ng di ay
shou ld aDI:Jellr

OOOOOOOF
00000012
00000015 31
00000018
",,,,",,,",,,",,,,18
0000001E 51
",,,1..,,,,,,,,.. 1

0000002A
0000002D

lA

11,
FI LECOKPAR I S,O'N UTll (F c)

5.8 ERROR MESSAGES

When the File i son Ut i i


"'Vlll1ll1tliill detects an er ror one or
more of the lowing error messages 11 be displayed:

Inval id ion>

One the swi that you have ified is invalid.

File not found:<filename>

FC cou d not read the filename you specified.

Read error n:<f lename>


FC cou d not read the entire file.

Invalid number of
You have specified the wrong number of ions on the
Fe command ine.

Bad f 1e
the files you specified s ive.

Data eft in <filename>


After reaching the end of one of the files in a file
comparison, the other filestill has data
left.

Internal error
This message indicates an internal logic error n the
Fe program.
12
6
LI

6. 1
This diSCUSSQS It s that
read ire use INK.

If you are not going to nk


you not to read
lled
es i one
program you can run
1i f les fOT def n tons of un~esolved
references
Resol external cross-references
a listing that both the resolution of
references and error
THE LINKER PROGRAH (MS-LINK)

6.2 OVERVIEW OF MS-LINK


When you write a program, you write it n source code. This
source code i s thro,ugh a comp i 1er wh i ch produces
object modules. The object modules must be passed through
the link process to machine language that the
computer can understand directly. This machine language is
in the form required for running programs.

You may wish to link i several programs and run them


Each of your programs may refer to a 1 that
is defined in another ect module. This reference is
called an
LINK combines several ect modules into one relocatable
oad module, or Run file 1 ed an .EXE or Executable
1il As it combines modules, INK makes sure that all
external ect modules are defined.
MS-LINK can search several Ii files for initions of
any externa references that are not defined in the ect
modules.
INK 1so a Li f e that shows external
references resolved, and t also displays any error
messages.
INK uses available memory as much as possible. When
available memory is exhausted, INK creates a
disk file named VM.TMP.
F gure 11ustrates the various parts of the MS-LINK
ion.
LI

Source Source

Assembler

.OBJ

MS-LINK

libraries
LST

Used if
Run file is VM.TMP Run fi
.EXE
memory

Fi 1: The LINK
6. FINITI Ll
terms used in thi are exp ained below
understand how INK works. Genera ly, f you
mlodu 1es comp i 1ed f r o m e Pasca 1, or a
1anguage, y'ou wi 1 not need know these terms
wr ing compiling programs n assembl
language, however, wi 1 to un!derstand INK
nit descr bel

shaded area group' addressa.bl

F y I Divi
e:
Name Class
Name

1
2
12

1. 2. and 12 havedi ........


a ......... names
not have thesa.e name.
1 12 a
the lowest of lowest address in

Each INK
loads rst
to

During ir
addresses does
this fi
a col that f t w n a
do not need to be
conti 1lustrat The address
of any lowest addre.. the n that
group. At link INK analyzes the groups, then
references the the address in of that
group. A may eo<ns i st of on,e orlllore groups.

If you are writ n may ass gn


group and class names h level
languages C. the naRtli ng is
done ie.11y the compiler.
LI

6.4 FI INK

INK:

Works with one or more iles

Produces two

be directed to search up to 1I f les

For each of i ve
spec f cat on The INK iJ
i the same that
:]

where: on ve
0: The
as dr ve

any filename of one to e

s one- to extens on the


f ename. The requ red as part of
the extension

6.4. F e Extens o,ns

f no f lename extensions are given n the i


file specif cations, MS-LINK will recognize
extens ons defau t:
OBJ
.L B
LI

6.4.2 ions

fol1 t extensions to
Li f les:

Run
.KAP L st

6.4.3 Fi 1e

the link session If the


create f 1e that exceeds
I wi 1 i let name
ton the d t dr ve. f
VH.TMP. it will
has been created.
diskette in drive >

has been di , you must not remove


the defau t ve the 1 nk session ends.
removed, the of NK w 1
and I1S-LINK mi ay the error
end of
The of VI1.TMP are written to the file named
fol ng the Run FIe: YK.TMP s a working file
only and is deleted at the end of the link ng session.
WARN
use V" .TKP as a f i 1en,ame for any i 1e If
a f lenamed V"'.TriP on the default dr ve
LINK requires the VM.TKP file, MS-LINK wll
the VM.TMP a1 on disk and create a new
Thus. the contents of the prey ous VM.TI'\P
11 be lost.
THE LI

65 TO NK

MS-LINK requ two command to star


INK and responses command In add ton,
seven control MS-LINK features. Usually, you will
command.s to I NK on the term i na I
As an ion answer command and
switches may conta a response fell e. Command
characters be used you wh e g ving commands
to INK

MS- INK may started in three The f


method the commands in response ndividua
In the second method you 11 commands on
line used INK. start NK the th
method, you must create response file that conta ns
the necessary commands and 1 INK where that f 1 is
when you start MS-LINK.

Methods Start MS- INK

Method LINK

Method 2 LINK <filenames>

Method LINK
LI

6.5. 1 1:

start INK
LINK
INK 11 then
display II t lie. You
answer the spec f c

each net oneorlllore tches.


the tch forward s 1
n
on.
PROMPT
ect les be
be
spaces
a
ast
the
wi reappear.
There s no defau t; a
response is requ red.
RunF i 1e ect-f 1e. Give f ename for
1e ect
defaul s
lenallleEXE.
the
i stFi 1 i 1e. ve filename for i ng
The defaul s RUN
filename.
L brar es [ ] L st filenames to
searched,
bank spaces or us signs
If a plus s gn s
the character
the w 11 reappear.
The default i to search
default librar es
the ect modules.
ions w 11 be
B, .)

o
LI

6 2 2: Line

To start
1 ne.
cODIII1and
must be
LINK e>.<1 tch J
LI are to cODIII1and
e ds for the different must be

where: 1 st of eet modu es

is the name the f e to ve the


Ie

i s the n,ame of the fIe rece ve the

a 1 st 1i modu es be

ionalsw be
any of the ust
cODIII1as or as

To select default for a f ld. s y a second


comma with no spaces between the two commas.
Ie:

B.L B
LI INK)

This command causes 1 ect


FUN.OBJ, TABLE.OBJ, and CARE.OBJ are
INK thenp,auses a result of using the
INK links the ect modules when you press
and a global 1 map (the swi
defaults to FUN. file; creates List file named
FUNLI .MAP; and searches the Li file CORLIB.LIB.

12
L

3: iF i 1e

To start INK with

LINK

where:

ts
entered from
1e thout

To use s ion. must create a le


containing several 1 text. the
response an INK The the
sameorder as the I'NK discussed I
des red, a long response to the or
L i brar i es: may be severa 1 a
us sgn to cont nue the same next
1 i ne.

Usesw command characters in the responsef le the


same way are for on the
terminal
the INK session will be
order with the f response
response fle not contain answers for all
(in the form ilenames. the sem co on
or carri NK 11 di ay
wh ch does not have re~SDC)nS,e. then wa t fOir you
egal response. When a lega response has been
INK !cont i nues the 1 i nk sess ion.

13
LINKER INK)

1e:

FUN TABLE CARE


/PAUSE/MAP
FUNLI
IS.LIB
This file tells
modules name FUN, TEXT, INK pauses
before i ali c
. . . . 11'...... 11,...
you to swap
disk d l scuss i o'n under section
before using this When any key, the
f i 1es will be named FUN.EXE and FUNLIST.MAP. MS-LINK
w 11 search the Ii file COBLIB.LIB, and will use the
default settings for the switches.

14
6.6

Plus si

us
f
owing
more
ibraries:
n. When
to be Ii es to be
been 1 i ste.d, response ine
e name and and a p us

e:

ieolan
To se eet default to
use si ngl e semi colon, (;) fol
carri return at any t me after
File: This feature saves time need
to a series of

15
LINKER PROGRAM

the semi on has been and entered


pressing the <RETURN> you can no
longer to any of the for that
link session. Therefore, do not use the
semicolon to skip some To skip
, use

1e:

Kodules
FUN TEXT TABLE CARE<RETURN>
Modu I e ; <RETURN>

will and MS-LINK will use the


including FUN.MAP for the List fil

Use the to abor the 1 nk session at any


time. If you an erroneous response, such as the
wrong filename or an incorrectly spelled filename, you
must press to exit INK then restart
MS-LINK. If the error has been but you have not
the <RETURN> , you may delete the erroneous
characters w th the for that line
only.

16
LI

message.

n square
wh ch can

[.
ect modules be nked.
that the f extens
i ename
be yen set the

I*\odu must be
that loads in
encountered. You _''11''.__'"''_,''' i onto
ich read

i1

filename will create a file for stor ng the


,e,(ec:ut:aD I f i Ie that resu I ts f rom the nk
Run f 1es reee ive the f i 1ename extens io'n
you spec; an extension other than .EXE.

7
THELI INK)

If no Is to Run File: prompt,


INK uses the first filename typed in response to
the ect Kodules: as the RUN filename.

Ie:

Run Fi Ie B:
re!IDC)nS;e d i r e c t s l NK to create the Runfi1e
.EXE on dr ve B:. Also, NK wi 1 pause,
which 110ws you to insert anew disk to receive the
Run f le.
i 1ename.

ns an for each in the


lese Each also the
the Run file.
The default response is the Run filename with the
default filename extens on .MAP.
[ ]:

The valid responses are up to e 1i fi Ienames


orsi y a carri return. carriage return means
default i search.) Li files must have been
created a 1i u t ill
must be by blank spaces or

INK searches Ii files in the order listed to


resolve external references. When it finds the module
that defines the external symbol, INK processes
that module as another module.

18
II

If INK cannot find a I file on the di in


the d sk drive., it wi1 di ay the mess.lata:

fi nd 1 i < 1, i ftrJ.r,,-r' .IIl~.>


new drive letter:
letter ive on
B)

19
LI PROGRAM INK)

6.8 INK ITCHES

The seven INK tches control various INK


functions. Sw tches must be at the end of a prompt
response, less of which method is used to start
INK. Switches may be grouped at the end of any
response, or may be scattered at the end of several. f
more than one swi at the end of one response,
each switch must be by a forward slash

All switches may be abbreviated. The only restriction s


that an abbreviat on must be a from the first
letter the last ; no gaps or trcan!.Dctsitions are
a 11 owed For examp, 1e:

Using the sw tch tel s load all


data at the end of the Data ise,
HS-LINK loads data at the ow end of the Data
At runtime, the pointer is set to the
lowest possible address to a low the entire
be used Use of the LOCATE switch in
combination with the t load low is, the
IGH sw tch is permits the user application
to ical1y allocate any available memory below the
area specifically allocated w thin DGroup, to
remain addressable the same OS pointer This
cal ocat i on is needed forPasca 1 and FORTRAN
I"'IVI'''I::arni

programs.
LI

caly
actual a.ount
aMOunt all JfIIIIIiII.iIIf/IIII>41111 . . . . . . .

cau.e. ae.
b1ei n "".""pu 11 .... 1"'...,1 ,
as low as poss

th or

ude in the
soure.
I I ' r i. . . . . . . . . . . I , I n.

all that
in 1 I'II ....... PIIII ..... ion.n
, of includ. ine
LI NKER PROGRAM NK)

/HAP
d rects to 1st all 1)
Is defined in the i modules. is not
given, I NK will 1 i s t only (including
undefined global

are I a ically. For


INK 1 sts its value and its fset
in the Run f Ie. Is are listed at
the the List 11e.

The switch causes INK to pause in the link


session when the switch I 1 y,
LINK the linking session n,n i ng to
end w thout ing. This switch the user to
swap the disks before INK (.
i e.

When NK the switch, it disp ays


the message:
About to file
disks <hit
resumes when the user any

CAUTION

Do hot remove the disk which 11 receive the


List file, or the disk used for the VM.TMP
file, if one has been created.
A 1
in
the
one (i a stac'k
ion statement ay the
ng error
ING:

s short for
tells INK to
1i i es in the if you
ing ing the
tch tells search
1i external
THE LI INK)

6.9 SAMPLE INK ION

is sample shows you the of is


displ during an INK session.
In response to

LINK
The 11 and
answers

Linker V2.00
Microsoft Inc.

l.

1 speei ing you both an a1


listing and a chronologica listing of
sy ols

2. ....Ii!!PII,,..,,PII,I"Iing to the List File: t you


can redirect your to the printer.

3. speci ing the switch, MS-LINK gives


you a listing of a 1 line numbers for all
modules. that the switch can
a large volume of

<RETURN> n response to the


an automatic 1i
~~.'~.~.~, search
LI

librar es, days


in the order of their appearance within
ist m ook th s:

The
20-b
........",r .." ..... ion in the
address
ion zero is
---- Inn
columns the
re ative to locat on
of the load module.
not the absolute where

switch was used, INK d ays the


pub1 i c name and va ue. For example:
THE LINKER PROGRAM (KS-LINK)

6.10 ERROR MESSAGES


All errors cause the link session to t. After the cause
has been found and corrected. MS-LINK must be rerun. The
following error messages are displayed by MS-LINK:

ATTEMPT DATA OUTSIDE SEGMENT BOUNDS. POSSIBLY BAD


OBJECT MODUL.E
is probably a Object file.

BAD NUMERIC
Numeric value is not in digits.

CANNOT OPEN FILE


MS-LINK is unable to create the f 1e VM.TMP because the
disk d i is fu 11 I nser t a new disk. Do no,t
remove the disk that will receive the List.MAP file.

ERROR: DUP
DUP record in assembly language module is too complex.
Simpli DUP record in assembly language program.

FIXUP FS FIELD WIDTH


An assembly anguage instruction refers to an address
with a short instruct on instead a long instruction.
Edit assembly language source and reas5emb e.

INPUT FILE READ ERROR


There is P\,P"""I"\!lII""ly a bad eetf i 1e.
INVALID
or ete

I two or more les that define a single


symbol name.

LINKER
The size may not the numbe'r
of may not exceed

S ZE

than or equal to th

SEGM,ENT SI
6ltK is addressi I im t.

CAPACITY
names were

"'ANY IN :ONE

The it is external s per modu e.


LINKER PROGRAM (MS-LINK)

TOO MANY GROUPS


limit is 10

TOO MANY LIBRARI I,F lED

limit is 8 libraries.

TOO MANY PUBLIC


The lim t s 1 1i c 1s.

MANY
The 1 i mit is and classes taken

UNRESOLVED <1 i st>

external Is listed have no ining module


among the modules or library files specified.

VM READ ERROR
This is a disk error; it is not caused by INK

WARNING: NO STACK SEGMENT


None of the ect modules specified contains a
statement allocating stack space, but you typed the
switch.
LI

WARNING:
There is ect e or an has been
made to 1ink les that INK cannot handle
an lute eet modul

WRI IN TMP FILE


No disk remains to the VM file.

WRITE ON RUNFI
Usually, there s not disk space for the Run
fi Ie.
APPENDI X ,A

This speci that


need at time. An e of th s
is a dey ce driver, such as an on ine pr nter. In
many there are instal ation-speeif c settings for
MS-DOS need to be confi at An
th s s a standard dey ce driver, such as an

The on ile allows


configure with a
f i 1e, deyi ce dr at
confi ion file is file that has
certain for The boot
process is as follows:
1. The disk boot sector is read. This conta ns
to, read code and theB I

2. code and BI are read.


3. A vari of 81 init al zetions are done.

A-l
HOW TO CONFIGURE YOUR SYSTEM

4. initialization routine reads the


ion file IG. t i f i tex i s ts, to
device installation and other user
.... &I"" .....Il......... ions.
Its final task is to execute the command
i which finishes the MS-DOS boot
process.

A-2
A. CHANG IG. FI

If there disk. you


canuse to create a file;
it on the d. i ... _.... ~....""

list the confi ion


This of sector that wi se
the list. If not set, 10 s a reasonab e

of f i 1es ca Is
can access. If not set 10 is a

CE- i I ename>

nstalls the device driver n ename> nto the


1 i st. be I ow )

- or
If ON s specified default is OF
as i will be made every time
ON improves the to abort
versi ons of the .. ,L.'-- ~,

SHELL -<f lename>


ins execution of shell level command
from <filename>.
HOW IGURE YOUR

COUNTRY <number>
Th i s number i s set to a 11 ow for i nternat ionia 1 date,
time, currency, and case conversion. Acceptable values
are:

United 1t va 1ue)
1

France

in
Por

Italy
United Kingdom

49
81
Israel
A ical confi ion f Ie might look like this:

Buffers 10
Files 10
Device IN\NETWORK.
Break ON
1 A: N\COMMAND.COM A:\BIN /P
Note here that the Buffers and Files are set to
10. The initialization routine will search for the
filename \8 to find the device that is being
added to the system. This fi e is usually supplied on disk
with your device. Make sure that you save the device file
in the that you specify in the Device
not

COUNTRY
e also sets the to
located on disk IN
s where ook for
it needs to re-read from d sk te ls
that it is the first running on the
it can process the IT command.
+ INK command Commands .)
15 EX I,
INK command F NO, 13
15
GOTO,
fil e, how

SH
Batch
Batch
B nary
Buffer

dev
d
ing
CHO R, command
Classes, 6
Command pi
Command
for KS-L 7
Commands ng
CHD R, ,1-1,
COPY,
CTTY
DEL, 1 i
DIR, 1 hierarch -2
ECHO, making,
EXE2B N, remove,

ndex-
irector .)
removing, 11
-2 INK
wor ng. 1 ,1 defined,
sample
i
VM
reader most
IIDma 111111

SOFTWARE PUBLICATIONS

Do Not Fold Here

Potrebbero piacerti anche