(Ms-Dos) : Microsoft - Disk Operating System A Practical Demonstration
(Ms-Dos) : Microsoft - Disk Operating System A Practical Demonstration
Ref: 57.113:Laboratory & Tutorial Manual - "Computer Application " - !ni"er ity of #ai$ato. %n t&i practical you 'ill be loo$in( at t&e M)-*+) operatin( y tem. ,y t&e en- of t&e practical you &oul- be able to u e imple M)-*+) comman- for pro-ucin( a -irectory li tin(. creatin( a -irectory. mo"in( from one -irectory to anot&er. -i playin( a file on t&e creen. printin( a file on paper. ancopyin(. renamin(. an- -eletin( file . /ou &oul- al o be familiar 'it& t&e concept of a directory, directory tree, path, files an- filenames. ,efore -oin( t&i practical. you &oul- &a"e co"ere- t&e t&eory note on )y tem oft'are in t&e on-line "01-e2cyclope-ia
Why do yo
T&e operating system i pro(ram t&at i re pon ible for eein( t&at t&e computer 'or$ correctly. %t mana(e y tem resources uc& a t&e C3!. primary memory. econ-ary memory 4-i $ -ri"e 5 any tem input an- output -e"ice uc& a t&e $eyboar-. creen. an- printer. %t al o pro"i-e t&e y tem interface '&ic& i t&e part of t&e y tem t&at interact 'it& you. t&e per on u in( t&e computer. T&i i t&e part of t&e operatin( y tem you actually ee. an- t&rou(& '&ic& you can control t&e computer. /ou mi(&t li$e to t&in$ of an operatin( y tem a an office secretary. T&i ecretary mu t mana(e t&e filin( mana(e me a(e an- re6ue t from taff pro"i-e client contact 'it& your or(ani ation. mana(e room an- re ource boo$in( . MS-DOS i t&e tan-ar- operatin( y tem for %,M 3C . AT . an- 3C an- AT clone . T&e acronym tan- for Micro)oft *i $ +peratin( )y tem. an- i fre6uently abbre"iate- to 7*+)8. %t u e a command line interface. '&ic& mean comman- are entere- into t&e computer by typin( t&e comman- name 'it& t&e $eyboar-. T&e a-"anta(e of uc& a y tem are implicity an- pee-. T&e -i a-"anta(e are t&at you &a"e to $no' t&e name an- format for t&e comman- before you can u e t&em. an- '&en p&y ically typin( t&em in. you can be prone to error .
to do#
$ile Organi%ation.
Computer are u e- to manipulate -ata. )ince it i be t to or(ani9e all t&e -ata pertainin( to a particular topic in t&e ame place an- t&i -ata nee- to be tore- for ome perio- of time. it can be tore- in a file. :ence. a file i a collection of related data. ;ile can contain te<t 4'or- . number . punctuation. etc5. number . or computer pro(ram . amon( ot&er t&in( . )ome file 4calle- text files5 can be rea- an-
[MSDOS.DOC]Page 1
un-er too- ea ily by &uman . '&ile ot&er 4calle- binary files5 are formatte- o t&e -ata t&ey contain can be rea- 6uic$ly an- ea ily by a computer. T&e operatin( y tem pro"i-e a mean for or(ani in( an- manipulatin( t&e file .
[MSDOS.DOC]Page 2
;ile can be or(ani9e- on a computer by torin( t&em in appropriate -irectorie . ;or in tance. 'e mi(&t &a"e one -irectory for torin( cla a i(nment . anot&er for torin( letter . an- yet anot&er for (ame an- uc&. *irectorie can al o contain ot&er -irectorie . calle- ub-irectorie . t&u 'e mi(&t brea$ our letter -irectory into t'o ub-irectorie . one for per onal letter an- one for bu ine letter . T&e -irectory abo"e any ub-irectory i referre- to a t&e parent -irectory. Loo$ at t&e -irectory 92data in t&e follo'in( -ia(ram. T&e root -irectory i t&e parent -irectory an- 92data i a ub-irectory. 92data i al o t&e parent of personal. an- corre pon-in(ly. personal i a ub-irectory of t&e 92data -irectory. \ (Root) 92data 92data works games dos personal sf100 hf100 works games dos
\ (Root)
personal
sf100
hf100
Directory tree
Directory trees.
*irectory tructure can be repre ente- by a -ia(ram calle- a -irectory tree 4)ee -ia(ram abo"e5. At t&e top of t&e tree i t&e root -irectory. %n M)-*+) t&e root -irectory i -e i(nate- by a bac$ la & ymbol 4"="5. Lo( on to t&e y tem if you &a"en8t alrea-y -one o. an- ta$e a loo$ at your creen prompt. %t &oul- loo$ li$e: H:\> T&e "::" i t&e name of t&e -i $ -ri"e you are currently u in(. T&e fir t bac$ la & after t&e -i $ name repre ent t&e root directory. #&en you lo( on. you 'ill automatically be place- in your o'n -irectory. a in-icate- by t&e y tem prompt. T&i i referre- to a your home directory. 2+T>: t&e &ome -irectory i not t&e ame a t&e current -irectory. /our &ome -irectory i al'ay t&e ame. but you can c&an(e your current -irectory in t&e cour e of a e ion.
&opying a file.
/ou can copy a ample file from t&e library -irectory 4?:=);1@@5 to your -irectory u in( t&e C+3/ comman-. Type t&e follo'in(: COPY J:\SF100\FILE1.TXT FILE1.TXT To un-er tan- '&at t&i -i-. con i-er t&e follo'in(. T&e C+3/ comman- loo$ li$e t&i : C+3/ sourcefile destinationfile
[MSDOS.DOC]Page 3
T&e 'or- in italic refer to (eneric file name an- &oul- 2+T be type- in a 'ritten. T&e source file i t&e file to be copie- an- can eit&er be a file in t&e current -irectory or anot&er -irectory. T&e destination file i t&e ne' file an- can al o be a file in t&e current -irectory or anot&er -irectory. )o in t&e Copy comman- you &a"e Au t u e-. t&e ource file 'a a file calle- ;%L>1.TBT in anot&er -irectory pecifie- 'it& a pat& 4?:=);1@@=5 an- t&e -e tination file 'a a file calle- ;%L>1.TBT in your o'n -irectory. T&e pat& tell M)-*+) '&ere to fin- t&e file in t&e -irectory tructure. %t pecifie all t&e -irectorie in t&e tructure from a $no'n location 4eit&er a -ri"e root or t&e current -irectory5. to t&e file 'ante-. %n t&i ca e t&e pat& (oe from t&e ; -ri"e root 4?:=5 -o'n to t&e );1@@ -irectory '&ic& contain t&e file to be copie-. Cerify t&at t&e file 'a copie- ucce fully be typin( *%R . /ou &oul- no' ee t&e file ;%L>1.TBT in t&e -irectory li tin(. 2o' ma$e anot&er copy of t&e file. but place it in t&e ame -irectory a t&e ource file. ;ir t. try typin(: COPY FILE1.TXT FILE1.TXT T&i &oul- ma$e a econ- copy of t&e file. ri(&tD ,ut notice t&at t&i comman- (enerate t&e error me a(e: File cannot be co ie! onto it"el# 0 #ile" co ie! %t ma$e en e '&en you t&in$ about it. /ou &a"e to pecify a -e tination file 'it& a ne' name. Type COPY FILE1.TXT FILE$.TXT ,ecau e t&e -e tination file &a a -ifferent name from t&e ource file. t&e comman- &oul- 'or$ properly no'. WA !"!#: if t&ere alrea-y e<i t a file 'it& t&e ame name a your -e tination file. t&e e<i tin( file 'ill be o"er'ritten by t&e ne' one an- it ori(inal content lo t. 2o error me a(e 'ill be (i"en to 'arn you of t&i . o be careful you -o not -e troy an important file '&en u in( t&e C+3/ comman-. To be ure you &a"e (ra pe- t&e Copy comman-. copy t&e file ;%L>1.TBT to a ne' file calle"M$%"&'(DA)"
Directory listings.
)o far you &a"e u e- t&e *ir comman- for eein( all t&e file in a -irectory. :o'e"er. you can pecify t&at you only 'ant file meetin( particular criteria li te-. T&e comman- loo$ li$e t&i : *%R filespec 2+T>: a(ain t&e 'or- in italic refer to a (eneric file name. an- &oul- 2+T be type- in a 'ritten. %n t&e ca e of t&e *%R comman-. t&e file pecification 4file pec5 refer to t&e file you 'i & to loo$ at. %t can be left blan$. in '&ic& ca e a li tin( of all t&e file in t&e current -irectory 'ill be li te-. #&en you 'ant to loo$ at only ome of t&e file . you can pecify t&i by mean of a 'il-car- c&aracter. in-icate- by an a teri $ "E". 4 ee t&e *+) appen-i< for more on 'il-car- 5. ;or e<ample. Type: DIR %.TXT T&i &oul- pro-uce a li tin( of only t&e file 'it& t&e e<ten ion "TBT". (enerally con i-ere- to in-icate a file containin( &uman-rea-able te<t. Anot&er e<ample. type: DIR FILE% T&i 'ill pro-uce a li tin( of all t&e file 'it& a name tartin( 'it& ";%L>" follo'e- by an e<ten ion 4"TBT". "*AT". "#3)". "#F)" etc5. /ou &oul- al o &a"e notice- t&at t&e *%R comman- (i"e you more information t&an Au t '&at file are in a -irectory. Ta$e t&e follo'in( e<ample '&ere you mi(&t ee omet&in( li$e t&e follo'in(:
[MSDOS.DOC]Page 4
[MSDOS.DOC]Page
T&i in-icate t&at t&ere i one file in t&e -irectory. name- ";%L>1.TBT". T&e 11G in-icate t&e number of byte containe- in t&e file . tellin( you &o' lar(e t&e file i . +ne byte i rou(&ly e6ui"alent to one c&aracter. T&e remain-er of t&e line (i"e t&e -ate an- time t&e file 'a create-. At t&e bottom of t&e -irectory li tin( i &o' muc& pace i left on t&e '&ole -i $. 2+T>: t&i i 2+T &o' muc& empty pace you &a"e in your -irectoryH ;or practical rea on . eac& u er of t&e net'or$ i allo'e- only a certain amount of -i $ pace o t&at one per on -oe not ta$e up t&e entire -i $. A a re ult. you may run out of room in your account e"en t&ou(& your -irectory li tin( ay t&ere are many million of byte a"ailable. /ou8"e een ome file name in -irectory li tin( . %n M)-*+). filename con i t of t'o part . t&e name proper. '&ic& can contain up to ei(&t c&aracter . an- t&e e<ten ion. '&ic& contain up to t&ree c&aracter . T&e e are t&e fir t t'o item on a line in a -irectory li tin(. T&e name -i tin(ui &e t&e file. an- t&e e<ten ion tell '&at $in- of file it i . T&ere are e"eral tan-ar- e<ten ion protocol . ;or e<ample "TBT" in-icate a te<t file. "*AT" in-icate a -ata file. "#3)" in-icate a #or$ #or-proce in( file. "etc. 2ote: t&at '&en you 'rite a file name. t&e name an- t&e e<ten ion are Aoine- to(et&er 'it& a full- top "." 'it& no pace bet'een. #&en a file name appear in a -irectory li tin( a abo"e. &o'e"er. t&e file name an- t&e e<ten ion are -i playe- eparately. 'it& no full top bet'een.
TYPE FILE1.TXT )ome te<t &oul- appear on t&e creen in a rea-able form. 2ote &o'e"er t&at it croll by too fa t to rea-. T&i can be correcte- 'it& t&e M+R> comman-. Type: TYPE FILE1.TXT 23ORE T&i &a t&e effect of brea$in( t&e te<t in t&e file into creen i9e- piece . allo'in( you to rea- t&e te<t con"eniently. 4T&e $ey i I &iftJ I=J on mo t $eyboar- an- may appear bro$en in t'o on t&e creen.5 2+T>: t&e T/3> comman- only 'or$ 'it& te<t file H ,inary file 'ill appear a (arba(e. an"ie'in( t&em on t&e creen can alter t&e ettin( on your computer.
&reating s 'directories.
A mentione- earlier. relate- file can be or(ani e- in ub-irectorie . /ou can create a ub-irectory u in( t&e "M*" 4"Ma$e *irectory"5 comman- in re pon e to t&e M)-*+) prompt. T&e "M*" comman- loo$ li$e: M* newdir A before. t&e 'or- in italic repre ent a (eneric -irectory name an- &oul- not be type- in a 'ritten. )ub titute t&e name of t&e ne' -irectory to be create-. T&i ne' -irectory 'ill appear a a ub-irectory in t&e current -irectory.
[MSDOS.DOC]Page !
! e t&e M* comman- to create a -irectory calle- "M/*%R". #&ile till in your &ome -irectory. type t&e follo'in(: 3D 3YDIR Confirm t&at it &a been create- by (ettin( a -irectory li tin(. /ou &oul- ee t&e name of t&e ne' ub-irectory in t&e -irectory li tin(. 2otice t&at after t&e ub-irectory name "M/*%R" a "I*%RJ" appear in tea- of an e<ten ion. i(nifyin( t&at it i a -irectory an- not a re(ular file. A a ne' -irectory. M/*%R i empty. To put a file in t&e -irectory. type: COPY FILE1.TXT \3YDIR\FILE1.TXT 2ote t&e u e of t&e pat& to pecify t&at t&e -e tination file i in anot&er -irectory.
&hanging directories.
T&e ne<t tep i to ma$e t&e ne' ub-irectory t&e current -irectory. #&en you lo( in. you 'ill al'ay be place- in your &ome -irectory. T&i i you current -irectory '&en you tart. At time you may 'i & to 'or$ in anot&er -irectory. /ou can c&an(e t&e current -irectory by u in( t&e "C*" 4"c&an(e -irectory"5 comman-. '&ic& loo$ li$e t&i : C* dirname T&e 'or- in italic repre ent t&e name of t&e -irectory to be c&an(e- to. an- &oul- not be type- a 'ritten. Type: CD 3YDIR 2ote t&at t&e prompt &a c&an(e- to loo$ li$e: H:\3YDIR> T&e prompt i et up to &o' you '&ic& -irectory i t&e current -irectory. T&i 'ay you 'ill al'ay $no' '&ere you are currently in t&e -irectory tructure. Loo$ at t&e -irectory li tin(. /ou &oul- ee t&e file you copie- into t&e ub-irectory. 2o' type: Di1 H:\ T&i &oul- &o' you t&e li tin( for t&e root -irectory. a you &a"e pecifie- t&e root 'it& a pat&. Alternati"ely. you coul- u e t&e *+) notation for parent -irectorie . %n eac& li tin(. at t&e top you 'ill ee a line 'it& a -irectory name- "." an- anot&er name- "..". T&i i M)-*+)8 'ay of follo'in( t&e -irectory tructure. T&e "." refer to t&e current -irectory. an- ".." to t&e parent -irectory. Type: Di1 .. T&i &oul- al o (i"e t&e -irectory li tin( for t&e root -irectory. '&ic& i t&e parent of M/*%R. T&e . .. notation 'ill 'or$ 'it& t&e ot&er comman- . Type: CD .. T&i 'ill ma$e t&e parent -irectory t&e current -irectory. C&ec$ t&e prompt an- (et a -irectory li tin( to "erify t&at you are bac$ in your &ome -irectory. T&en ma$e M/*%R t&e current -irectory a(ain.
[MSDOS.DOC]Page 7
*enaming a file.
T&ere are time '&en you 'ant to (i"e a file a ne' name 'it&out c&an(in( t&e content . ;or e<ample. a file may &a"e been name- incorrectly an- t&e name mu t be c&an(e- to (et t&e computer to -o '&at you 'ant. ;ile name can be c&an(e- by mean of t&e R>2 comman-. '&ic& &a t&e follo'in( ynta<: R>2 oldname newname T&e R>2 comman- ta$e an e<i tin( file. "ol-name". an- (i"e it a ne' name "ne'name". Try renamin( t&e file in t&e M/*%R -irectory. Type t&e follo'in(: RE5 FILE1.TXT J657.TXT T&i 'ill rename t&e file ;%L>1.TBT to ?!2F.TBT. Let a -irectory li tin( to confirm t&i &a 'or$e-. At ome point you may for(et t&e proper 'ay to u e t&e R>2 comman- an- only (i"e it one file name. 2o 'orrie K you 'ill imply (et an error me a(e li$e t&i : Re89i1e! a1a*ete1 *i""in: 2o &arm 'ill be -one to t&e y tem or your file . Try typin( RE5 R6//ISH.TXT /ou &oul- ee t&e error me a(e. %t &oul- al o &o' t&at ma$in( mi ta$e on a computer i not -i a trou 4u ually5.
Deleting a file.
A you continue to u e t&e computer. you 'ill accumulate file '&ic& are no lon(er nee-e-. To a"e pace on t&e -i $. it8 a (oo- i-ea to -elete file you -on8t nee- any more. an- you &oul- try to ma$e cleanin( out re-un-ant file a re(ular &abit. T&i i -one 'it& t&e *>L comman-. *>L filespec T&i remo"e t&e file from t&e -irectory li tin(. ,e carefulH +nce you -elete a file t&ere i no ea y 'ay to (et it bac$. T&e information it contain 'ill be lo t. o u e t&i comman- 'it& care. )ome e<ample are: *>L +L*;%L>.TBT T&i 'ill -elete t&e file +L*;%L>.TBT. #il-car- can al o be u e- 'it& t&e *>L comman-: *>L E.+L* *>L +L*;%L>.E T&e fir t e<ample 'ill -elete all t&e file 'it& t&e e<ten ion +L*. re(ar-le of t&e file name. T&e econ- 'ill -elete all file 'it& t&e name +L*;%L>. re(ar-le of t&e e<ten ion. WA !"!#:. *>L E.E T&i comman- 'ill -elete all t&e file in your current -irectory. ,ecau e t&i coul- be -i a trou . it 'ill fir t a $ you ;1e 0o9 "91e +Y45,< %f you type ! . it 'ill top 'it&out -eletin( anyt&in(. %f you type $ it 'ill (o a&eaan- -elete all t&e file in t&e -irectory. ,e careful 'it& t&i one. becau e you cannot retrie"e -eletefile . Try t&e *>L comman-. ;ir t -o a *%R comman- to "ie' t&e file currently in t&e M/*%R -irectory. T&en type: DEL J657.TXT :ere8 a ba- one:
[MSDOS.DOC]Page "
2o' -o a *%R comman-. %f all 'ent 'ell. t&e file ?!2F.TBT &oul- no lon(er be in t&e -irectory.
[MSDOS.DOC]Page #
Deleting directories.
C&an(e t&e current -irectory bac$ to t&e root. T&e comman- to remo"e a -irectory i : R* dirname #&ere R* tan- for 7Remo"e *irectory8. an- -irname i t&e name of t&e -irectory to be -elete-. %t i important t&at t&e -irectory to be -elete- i empty. M)-*+) 'ill pre"ent you from -eletin( any -irectory '&ic& contain file . Ma$e ure t&at t&e M/*%R ub-irectory i in fact empty. T&en type: RD 3YDIR Let a -irectory li tin( to confirm t&at t&e -irectory &a been -elete-.
+rinting a file.
#&en you 'ant to obtain a printout of a file 4$no'n a &ar- copy. a oppo e- to oft copy. '&ic& refer to file on a -i $5. you can u e t&e 3R%2T comman-. T&i &a t&e follo'in( ynta<: 3R%2T filename A before. t&e 'or- in italic refer to a (eneric file name an- &oul- not be type- in a 'ritten. To obtain a &ar- copy of t&e file ;%L>.TBT. type t&e follo'in( comman-: PRI5T FILE1.TXT T&i 'ill en- a copy of t&e file to t&e printer. %t may ta$e a fe' minute for t&e file to be printe-. e pecially if many people are u in( t&e printer. o plea e be patient.
[MSDOS.DOC]Page 10
2otice t&at you are till in t&e ame -irectory on t&e ame -ri"e. ,ut '&en you 'itc& to t&e ?: -ri"e. you 'ill automatically be in ?:=);1@@. t&e ne' -efault -irectory for t&at -ri"e. Try t&i an- e<amine t&e ne' -efault -irectory name. ! e t&e comman- you &a"e e<amine- for c&an(in( bet'een -i $ an- -irectorie . an- for li tin( -irectory content . to e<plore t&e -irectory tructure on t&e ?: -ri"e.
[MSDOS.DOC]Page 11
.. Miscellaneo s &ommands.
To fini &. &ere are a fe' comman- '&ic& may be of u e. ;ir t. ma$e ure you are in your o'n root -irectory 4::=5. a5 To fin- t&e current -ata or time. M)-*+) pro"i-e t&e *AT> an- T%M> comman- . Type
D;TE /ou &oul- ee a me a(e li$e: C911ent !ate i" =C911ent !ate= Ente1 ne> !ate +**'!!'00,:? %f t&e current -ata -i playe- i 'ron(. correct it by typin( t&e -ata in t&e format pecifie- 4mont&--ayyear5. +t&er'i e pre . T&e T%M> comman- 'or$ in a imilar manner. Try it out. b5 Clearin( t&e creen. )ometime you may fin- your creen co"ere- in (arba(e. or too cro'-eto compre&en- in a trai(&tfor'ar- 'ay. To clear t&e creen. M)-*+) pro"i-e t&e CL) comman-. Type: CLS T&e creen &oul- no' be blan$. e<cept for t&e prompt in t&e top left-&an- corner. c5 )ettin( t&e prompt. M)-*+) allo' you to c&an(e t&e prompt to uit your o'n preference . T&e prompt comman- loo$ li$e 3R+M3T $character $character #&ere Mc&aracter can be any of t&e follo'in(: M- T&e current -ate Mt T&e current time Mp T&e current -irectory M( T&e J c&aracter Ml T&e I c&aracter M6 T&e N c&aracter Mb T&e O c&aracter MM T&e M c&aracter M& ,ac$ pace 4era e a c&aracter 'ritten to t&e prompt5 T&e current prompt i et to MpM(. Try typin(:
PRO3PT @:@: 2o' you &oul- ee t&e prompt a "JJ". /ou can a-- t&in( li$e t&e time to t&e prompt. T&i i &an-y a it 'ill (enerally be ri(&t in front of you. Type PRO3PT @t@: /ou 'ill ee t&at t&i (i"e t&e time far more preci ely t&an mo t people 'ill re6uire. /ou can trim t&e "alue (i"en by era in( ome of t&e c&aracter to t&e ri(&t. u in( bac$ pace. Type T&i PRO3PT @t@A@A@A@A@A@A@: &oul- be a little ea ier to un-er tan- at a (lance. Con i-er '&at &i prompt comman- -oe :
PRO3PT @!@A@A@A@A@A@A@A@A@A@A@t@A@A@A@A@A@A @ @: Try a fe' of t&e combination an- ee '&at &appen . %f you inten- re(ularly u in( a -ifferent prompt. remember to inclu-e Mp. o t&at you $no' at a (lance '&at your current -irectory i .
[MSDOS.DOC]Page 12