Professional Documents
Culture Documents
An Introduction to
MS DOS
An Introduction to MS DOS
1.0
Introduction
DOS is an acronym for Disk Operating System. When IBM released the
Personal Computer in 1981, using the Intel 8088 as the CPU, Microsoft
Corporation was approached to provide the operating system for the same.
Microsoft created MS DOS, the Microsoft Disk Operating System for the IBM
personal computers. It controls different parts of the personal computer i.e. the
Input / Output devices like monitors, printers, disk drives etc.
(C:\ and A:\ are known as C prompt and A prompt respectively. This is an
indication for the user to know that the computer is ready for executing
commands)
In case a floppy is present while booting, it must be bootable, i.e., it should
have the three main files COMMAND.COM, IO.SYS and MSDOS.SYS.
Otherwise, after confirming that a floppy is inside the drive which is not
bootable, the computer will give an error message.
Bad or missing command interpreter
DOS is a single user and single tasking system. The first software was called
as DOS Version 1.0 which had all the basic features. Since then, several new
features have been incorporated. The latest version of DOS, is Ver 6.22. The
basic hardware requirement for ver 6.22 is a 16 bit Personal Computer with
640 KB RAM and a hard disk & Floppy drives.
Booting DOS
The basic software which makes the user to interact with the machine and
control to some extent is called the Operating System. Whenever the computer
is switched on the operating system gets loaded into the memory. The process
of loading DOS is called as booting DOS. To boot DOS, switch on the
computer. Once started up, the computer performs its self-test i.e. power-on
hardware diagnostics called POST (Power ON Self Test). At this time, the
computer examines most of its critical hardware components. The computer
then displays the amount of memory present on the system. It checks the
floppy drive (if available on the machine) to see if a floppy has been inserted. If
there is no floppy, it checks the hard disk, loads IO.SYS and MSDOS.SYS
into the RAM and runs a file called CONFIG.SYS and then loads
COMMAND.COM. Thereafter, AUTOEXEC.BAT is executed.
Once the system boots up properly it displays the DOS prompt along with a
blinking cursor which tells that anything typed will appear at that point:
C:\> if the booting is done from the harddisk., A:\> if the booting is done from
Floppy disk.
In such a case, remove the earlier floppy diskette and insert a bootable diskette
and start the computer again.
An Introduction to MS DOS
DIR filename
It will display the file and other related information, if the file is present,
otherwise it gives the message as file not found.
C:\>DIR CONFIG.SYS
MS DOS
/P Pauses at the end of the screen and waits for a key to be pressed.
/S Displays files in a specified directory and all subdirectories.
Internal commands are built into DOS and can be executed at any time. They
get loaded into the computers memory as soon as the machine is switched on.
External commands are disk-based commands that reside on the DOS disk
and require other special specific files, apart from the three main files.
1.2
Internal Commands
The CPU, i.e., the Central Processing Unit, is the main controller i.e. heart of
the computer and all the commands are processed by it. The internal
commands are present in the RAM while the machine is on. Whenever the user
issues a command, the CPU checks up the RAM. If the command is an internal
one, the CPU performs the operation as per the command and the output is
displayed to the user. The main advantage internal command is that they are
executed faster. Therefore, the commands which are needed most often are
internal as it saves a lot of time.
1.2.1
It is used to list any or all the files and subdirectories in a directory. The drive,
path, switches and wildcards can be used.
Syntax: DIR
C:\>DIR
? St. Xavier College
/A Displays all the files with set attributes like hidden files etc.
C:\>DIR/P
1.2.2
Wildcard Characters
Wildcard characters, i.e., * (asterisk) and ? (question mark) are used in cases
when a number of files have to be referred or a specific file when full-name is
not known. * can be used to replace characters anywhere from 1 to 8 (from
that location to end of the extension) before the . and 1 to 3 characters after
the . while ? can be used to replace only one character.
1.2.3
TYPE
It displays the contents of a specified file on the screen. Wildcards are not
allowed. The output of TYPE can be redirected to the printer or to another file.
Syntax: TYPE filename
C:\>TYPE CONFIG.SYS
An Introduction to MS DOS
1.2.4
CLS
Any name which is not indicated by hyphen lines means that it is a filename
and not a directory name.
This command clears the screen and displays the command prompt and
cursor.
Syntax: CLS
1.2.5
Making a Directory
or
or
MD path\<directory name>
C:\>MD DOE <RETURN>
Creates subdirectory DOE in the root directory.
1.2.6
Changing a Directory
Syntax: CD [path]dirname
C:\>CD XAVIER1
INSTITUTE1
PROGRAM1
INSTITUTE2
This will move the user from the current directory, i.e., root to the directory
XAVIER1. After execution, the prompt will change to:
C:\XAVIER1>
PROGRAM2
1.2.7
SECTION1
SECTION2
DEL
The Delete command erases one or more files from the directory. Wildcard
characters can be used with this command.
ST1
An Introduction to MS DOS
C:\>DEL TEMP
1.2.8
Copies ABC to XYZ thereby creating two files ABC and XYZ which have the
same contents.
PROMPT
COPY path \ sourcefilename(s) path
This is an internal command used to customise the DOS prompt. To use certain
characters, the appropriate options should be entered in the prompt string.
Syntax: PROMPT options
It will copy the specified file or files from the directory mentioned in the path to
the target path under the same name or names (in case many files are being
copied). If a different name is desired in the target directory, then a new name
has to be mentioned for the copied file in the target path.
Options are:
C:\>COPY C:\YACH\FILE1 C:\TEMP <RETURN>
$P Displays the current disk drive and path.
$G Displays the greater than symbol.
It will copy file1 from the yach directory to the temp directory under the same
name, i.e., file1.
1.2.10 REN
This is an internal command that renames a file on the disk. (The old and the
new names have to be specified). Wildcard character can also be used, either
in the old or the new name. If a file in the directory already exists with the new
file name, a Duplicate file name message is displayed and the operation is
terminated.
or
COPY
Try out the following command: C:\>REN LETTER.TXT LETTER.DOC
This command copies files between disk drives and/or devices, either keeping
the same file name or changing it. COPY can concatenate two or more files into
another file or append one or more files to another file.
Syntax: COPY sourcefilename targetfilename
It will make a duplicate copy of the sourcefile under the new targetfile name.
C:\>COPY ABC XYZ <RETURN>
? St. Xavier college
An Introduction to MS DOS
1.2.11 Removing a Directory
1.3
In the DOS there are few commands which have the extension as .COM or
.EXE. These commands are called as external commands as they have to be
available on the disk if required to be executed.
Syntax:
In case the command is an external one, i.e., not present in the RAM, then the
CPU checks up the disk from where the system has been booted and picks up
for its execution. Thereafter, it executes the command and then clears that
command from the RAM.
RD dirname or RD path/dirname
Before executing the RD command certain things are necessary to be taken
care of :
Rule 1.
Rule 2.
Always remove the child directory from the parent directory. Never try
removing a directory without exiting it. However, the child directory
can be removed without giving the path from the parent directory.
CD.. always takes the user to the immediate parent.
External Commands
MORE
Normally whenever a big file is typed, the contents scroll off the screen until the
end of the file is reached. The MORE command displays one screenful of
information. If the size of the file is more than a screen then the screen pauses
at the end of a page displaying the message More--.
Syntax: MORE filename
Less than symbol is used to redirect the programs input. MORE is going to
take the file contents as input and then display them one screen at a time. To
abort any such operation midway press CTRL key and C key simultaneously.
C:\>MORE <README.TXT <RETURN>
It will display the contents of readme.txt file page by page.
1.3.2
PIPE
This is used to pass on the output of one command as input to the other
command and is represented as !.
Syntax: command1 ? command2
C:\>DIR ? MORE
An Introduction to MS DOS
It will redirect the output of DIR command to MORE command which will
display it page by page. If there is some more information then the message
appears more- displayed at the end of every page.
1.3.3
MOVE
This command moves one or more files to another directory. It is also used for
renaming a directory.
C:\YACH>
C:\YACH>PRINT P DOS_1
1.3.5
XCOPY
Copies files (except hidden and system files) and trees directly. This command
is most helpful when a copy of a full directory along with its subdirectories is
required, without going through the process to create subdirectories and then
copying their files etc.
OR
Syntax: XCOPY sourcefile ? sourcedir sourcefile ? sourcedir [/option 1]
MOVE PATH\SOURCEFILENAME(s) PATH
!
indicates or
It will move the source file from its original path to the new directory under a
new name, if a new name is mentioned.
1.3.4
destination
Prints a list of files on the printer while the computer performs other tasks. It
prints a text file while other MS-DOS commands are being executed.
OPTIONS:
/P
/S
/W
Syntax:
PRINT filename1 [filename2]
C:\YACH>PRINT P <RETURN>
? St. Xavier college
An Introduction to MS DOS
To copy file PAIR to another file RARE in the same directory the following
command is given
TREE
ROOT Directory
The root directory area records details about the files that
are stored on the disk. For each file stored, there is a
directory entry that records the file name, size, date and
the time corresponding to when the file was last
modified.
The root directory also holds the starting cluster number
for the file. The size of the root directory is fixed for each
type of disk and this size determines the number of
entries it can hold.
FORMAT
The DOS FORMAT command prepares a disk for use. It divides a disk into two
areas.
System area
User area
1.3.8
System area consists of the boot area (which is the first sector on the disk), the
file allocation table and the root directory.
Boot Area
CHKDSK
Checks the directory and the file allocation table (FAT) of the disk and reports
about the disk and memory status. CHKDSK can also repair errors in the
directories.
Syntax:
CHKDSK drive: /F
File Allocation
An Introduction to MS DOS
1.4
Exercise
a)
1.
Copy all files with an extension .EXE or .COM from you DOS floppy (from
hard disk if your computer has one) onto the floppy you have formatted.
b)
c)
Delete all files with secondary name as .BAK and primary name less than
6 characters. Execute this command, under you instructors supervision.
d)
3.
e)
4.
Change the DOS prompt, so as to display the directory name with the
prompt.\
f)
A DEL TREE command that deletes a directory along with all its files
and subdirectories
5.
g)
MOVE command that moves one or more files from one directory or
drive to another
h)
i)
6.
a.
b.
b.
c.
d.
e.
An Introduction to MS DOS
1.0 INTRODUCTION
This work book is intended for students enrolled in B. Sc.
Computer Science of SXC. This lab work book deals with use of
various commands and features available in MS-DOS for
computer operation, file and disk management, and batch file
processing.
2.0 ORGANISATION
This lab work book introduces you to, various components of a
computer and their uses, operating system and its importance,
and various commands of DOS, various facilities available in DOS
for file and disk management, printing and displaying disk files.
2.1 Procedure
4.1 Objectives
To make best use of the practical, you are advised to take the
following steps:
1.
2.
read this book let carefully before attending the lab session
3.
4.
An Introduction to MS DOS
5.
3.1 Objectives
At end of this session, you will be able to do the following:
?? identify various parts of a computer
6.
in case of any difficulties consult the lab supervisor for
clarification.
7.
workout
possible
answers
(commands),
necessary, before you go to Lab for practical session.
wherever
EXERCISE 1
This exercise, needs a computer in front of you to answer the
following questions by making observations. As soon as you enter
into your Lab room, request your instructor to take you to a
computer. Some of the questions may require certain amount of
discussion among your fellow students and instructor. Try your
best to answer all the questions.
1.
2.
3.
4.
How many floppy drives does your computer have? Identify
the drives.
An Introduction to MS DOS
5.
What is the size and capacity of floppy drive used by your
computer ?
13.
What is the system reset keys,or combination of keys for
your computer?
6.
Does your computer have a hard disk? If yes, what is the
storage capacity?
14.
Does your computer have a mouse? If yes, identify the
connecting port and type of the mouse you are using.
7.
Identify the CPU of your computer. What is the processing
speed of your computer?
15.
8.
9.
10.
What type of printer is connected to your computer? What
is the printing speed?
11.
12.
Software Types
How many ports does your computer have? List the names
and their types.
EXERCISE II
So far this booklet has introduced you to the micro computer, its
various part and their uses. In this exercise you are expected to
do the following.
?? obtain the floppy disk, use it and put it back in the
correct location after you finish your work.
?? start the system from a switched-off state and shut it
down when finished.
Proceed through the following steps one at a time :
1.
Obtain the Disk Operating System disk (normally known as
Boot Disk).
S1.NO.
1.
2.
3.
4.
5.
2.
An Introduction to MS DOS
3.
Switch on the computer and the monitor. The drive light will
be on and the Operating System will be copied from
the inserted disk into the computer's memory.
4.
4.
5.
5.
6.
6.
EXERCISE III
1.
2.
Using DATE and TIME commands, change the system
date and time.
3.
6.
Copy the file DSK.EXE from drive A into DISKCOPY.COM
onto A itself.
7.
8.
Issue command to display all files with extension .EXE. one
screen full at a time.
9.
10.
Change the, name of all files with extension.COM on disk A
as.BAK files.
11.
12.
13.
14.
List the contents of the A disk and simultaneously take a
printout.
15.
Change the DOS prompt, so as to display the directory
name with the prompt.
An Introduction to MS DOS
16.
Switch off the computer and make sure that all the
connected devices such as monitor, printer etc. are
switched off.
3.
Set the path on disk A so as to include all directories and
sub-directories.
LAB SESSION II
4.1 Objectives
This session deals with advance commands sequence of MSDOS. At the end of this session, you shall be able to:
?? understand the use of advance commands of DOS
?? write batch files in DOS, using various DOS
commands
EXERCISE I
1.
2.
Copy all the files with an extension of. COM from C disk
onto the SXCMAIN sub-directory of A.
4.
Copy all files with extension .EXE from disk C to the subdirectory EXE on disk A.
5.
6.
Copy all files with extension .BAT from sub-directory SXC
to sub-directory BAT on disk A.
7.
9.
10.
ROOT
SXCMAIN
EXERCISE II
1.
EXE
COM
BAT
8.
Go to the directory BAT and display the contents of the file
AUTOEXEC.BAT.
SXC
2.
Create a file STUDENT.DOC containing 15 names of any
of your friends, using EDLIN.
An Introduction to MS DOS
3.
In the file STUDENT.DOC delete the names at the 6th. and
8th. position.
7.
far.
Take the printout of all the batch files you have written so
4.
8.
Switch off the computer and make sure that all the
connected devices such as monitor, printer etc. are
switched off.
a.
argument
b.
delete all files from the sub-directory EXE (consider
the directory structure given in Exercise 1).
5.
5.
a.
include a comment 'You are executing a Batch file,
for formatting disks'
b.
c.
d.
e.
At the end of formatting, display the message
'Formatting is Over'.
THE END