We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 9
INTRODUCTION
TO MS-DOS
‘An operating system is an organizedd set or collection of software programs that controls
the overall operation of the computer system. It controls and directs the flow of data and
instruction from one part of the computer to another. As you already know, a computer
is nothing but a collection of various hardware devices such as the keyboard, the visual
display unit (VDU), the central processing unit (CPU), etc. It is the operating system (OS)
that makes these independent hardware devices a single entity and easy to use and
manage.
MS-DOS stands for Micro Soft Disk Operating System. It was developed by Microsoft
Corporation for the IBM-PC.
Memory is the circuitry in a computer that stores information. The two types of memory
available are the RAM (Random Access Memory) and ROM (Read only Memory). RAM
is that part of the computer’s memory to which we have access. It stores programs and data
when the computer is on. ROM is the section of memory that you can only read from. This
stores the basic computer operating system and system routines.
ROM plays a major role in the operation of IBM-PCs. The ROM in any IBM-PC or its
compatible, consists of two different types of programs.
Initializing or Loading Routines
These routines first test the system and each of the peripheral devices, initialize various
components and make sure that the devices that are necessary for running the system are
present and operational. Then these programs search the disks for the OS routines and
programs. Once the OS routines and programs are found, ROM loading routines load the
OS routines into the main memory and then pass the control over to the operating system.
This process of loading the OS is called Booting.
The ROM-BIOS (Basic Input Output System)
The ROM-BIOS routines provide the fundamental services that are needed by the OS and
the programs. They are used for controlling the peripheral devices, reading/writing data
to and from the disks, displaying data on the screen, etc. These routines are used by each
and every program.
When the computer is powered on, after ROM BIOS completes its equipment check
routines, ie, POST (Power On Self Test), and assuming all is well, ROM BIOS reads the
first sector of the disk. The disk bootstrap program is found on the first sector of every MS-DOS diskette, and on the first sector of the partition allocated to MS-DOS on a hard disk.
ROM BIOS takes the disk bootstrap program to memory and executes it. The bootstrap
program then loads the Basic Input Output interface software (IO.SYS) into memory. If it
recognizes the IO.SYS file, it continues from there to read the file MSDOS.SYS. If it does
not recognize the IO.SYS file, it displays a message saying that the disk is not a system disk,
and asks you to load another, then press any key to continue.
Most of the DOS programs are stored in two files, namely IO.SYS and MSDOS.SYS.
Another file which contains DOS routines is the COMMAND.COM. The IO.SYS and
MSDOS.SYS are hidden files and are not visible to the user. COMMAND.COM is the
command processor. It is the program that sends the system prompt to the display and
looks and interprets the characters typed at the keyboard.
INTERNAL AND EXTERNAL COMMANDS
Internal commands are commands that are a part of the MS-DOS command interpreter.
They are small routines and are stored within the COMMAND. COM file.
External commands are not a part of COMMAND.COM. They are stored on a separate
disk.
COMMAND.COM contains a table which has the names of all the internal commands
stored in it. After accepting a command, it searches that table for the command just
entered. If found, the command is an internal command and its code from the
COMMAND.COM file will be executed. If the name of the command just entered is not
present in the table, the command is an external command. Hence, it searches for the
command on the disk and upon finding it, the command interpreter loads it into the
memory and executes it. Otherwise a message “Bad command or file name” is displayed.
Internal Commands
All the file names used in internal commands can be preceded by a drive name and a path
which are indicatied by the following terms.
d:- drive, sd:- source drive, td: - target drive, cd: - current directory
Clearing the screen—cLs
This command erases all the characters on the screen and takes the cursor control to the
first row of the screen.
Syntax: CLS
Entering the current date—DATE
DATE allows you to reset the system date to the current date or obtain the current date
from the system clock. In all the following commands, the parameters enclosed in square
brackets are optional.
Syntax: DATE (mm-dd-yy) or DATE (mm/dd@/yy) or DATE (mm.dd.yy]
Entering the current time-TIME
Displays the current time and allows you to reset the time.
Syntax: Time (hh:mm[(:ss [xx] ]Listing files in a directory-DIR
DIR is used to display the contents of a directory, ie, the file names, the file size in bytes,
the date and time of last modification, the number of bytes available on the disk, and any
subdirectories under the current directory. The file name under DOS is represented by a
primary name and a secondary name. The primary name can be upto 8 characters of
length; it is followed by a dot and a secondary name or extension. The secondary name
can be upto 3 characters of length. The file name can be made up of alphabets, digits _
underscores and hyphens. No other characters are allowed.
Syntax: DIR[d:] [path] [filename] [/P] [/W][/S]
Options
d:path £ilename-SPECIFY] the drive letter, path name, or file name when you wish
to obtain a directory listing of files that are not in the current directory.
/P-Tells DOS to pause when the screen has been filled. To see the next screen of file
names you have to press any key.
/W—Displays a directory showing only file name in a wide format—five names across each
line.
/s—Displays the files from the subdirectories also.
Examples
DIR C:—Displays the contents of the current working directory on drive C.
DIR C:*.MAC—Displays only those files in the current working directory of drive C that
have the MAC extension.
* and ? are called wild characters. * replaces a group of characters and ? replaces any one
character.
DIR S*.*—Displays only those files whose names are beginning with the letter S and
followed by any number of characters and with any extension.
DIR S?.*—Displays only those files whose names are beginning with the letter S and
followed by any one letter (or without any following character) with any extension or
without extension.
Displaying the contents of a filetype
TYPE displays a file’s content on the screen. This command continuously scrolls the file
on the screen. To freeze the text use Ctrl-Numlock or pouse key. To stop the TYPE
command press Ctrl-C. The contents of binary files and Exe files will be meaningless.
Only files which are in ASCII format can be typed.
Syntax: Type(d:] [path] filename
Examples
TYPE B:TEST.C—Displays the contents of the file TEST.C from drive B.
If the given file name does not exist in the directory, ‘File not Found’ message will be
displaved on the screen.Copying files—-copy
COPY is used to copy files with the same or different names.
Syntax:
COPY [/A] [/B] [sd:] [spath] sfilename(td:] [tpath]tfilename]
Options
/A ox /B indicates whether the preceding file and all subsequent files are to be read as
ASCI (text) or binary files, and it is in effect until further modified.
sd:spath sfilename—Specifies source file or files to be copied.
td:tpath tfilename-Specifies target file or files to be copied to. The filename can be
specified if you wish to rename the target file during copy. If not specified, the source file
name itself will be given to the target file also. But in this case the target drive or directory
must be specified. This is because we cannot store two files under same name in the same
directory.
/V-Tells DOS to verify that the target file is correct.
Examples
COPY COMMAND.COM A:—From the current drive the file COMMAND COM will be
copied to drive A.
COPY B:TEST.C—From the drive B: the file TEST.C will be copied to the current drive.
Deleting files-DEL
This command is used to delete any or groups of files from the directory.
Syntax: DEL [d:] [path] filename
Examples
DEL TEST. DBF-Erases the file TEST.DBF from the current directory. If the file is not
available in the directory ‘File not Found’ message will be displayed.
DEL C:\WS4\USHA\*.BAK-Deletes all files in directory C:\WS4\USHA with the
extension.BAK.
DEL C:\WS4~—Erases all the files in directory C:\WS4.
DEL A:*. *—Erases all the files in drive A regardless of the primary and secondary names.
But before erasing the following message will be prompted.
Are you sure(¥/N)
If you have given this command without knowing that it will erase all the files, you can give
N. This will bring the control back to prompt without erasing any files. But if you give ¥,
it will erase all the files from the directory.
Renaming files—Rename (REN)
‘This command will change the name of the given file, with the new name given by you.
REN will not allow two files to have the same name at the same time. Never rename
special files that application programs require to operate.
Syntax: REN[d:] [path]oldfilename newfilenameO1d£ilename-Specifies the file, to change its name.
newfilename-Specifies the new name to be assigned to the file (must be on the same
drive and path as the file to be renamed).
Examples
REN *.CAP *.SET—Renames all the files with extension .CAP as files with extension
SET, with the same corresponding primary names.
Messages
Duplicate file name or file not found—This error message will be given by DOS
at two cases. One, if the old file name given by you is not available in the given directory;
the other when the new file name already exists in the directory. For example, if the file
MYPROG.BAS is not available and you give the command as REN MYPROG.BAS
PROG.BAS, you will get this error message.
Creating new subdirectories-Mkdir (MD)
This command creates a new subdirectory.
Syntax: MD(d:]path
d:-Specifies the drive in which you wish to create the new subdirectory.
path-Specifies path of directory names, including the name of the sub-directory to be
created. The entire path name must not exceed 63 characters, including the backslashes.
Examples
MD PHONES—Creates a subdirectory PHONES under the current directory.
MD\WS4\FILES\PHONES-Creates a new subdirectory named PHONES under the
subdirectory FILES, which is under the subdirectory WS4, which in turn in under the root
directory.
Changing the current directory—Chdir(cp)
This command changes the current work directory to a new directory.
Syntax: CHDIR [d:] [path]
Examples
CD C:\WS4\LETTER~This command changes the current directory to LETTER which is
under WS4 on drive C. If no drive is specified current drive is assumed. If the given
subdirectory does not exist, then invalid message will be displayed.
cp\~Allows you to change to the root directory from the current working directory.
CD.., changes the current directory to the preceding level of the directory. For example,
after the command in the first example, if you give CD.., the current directory changes to
C:ws4, which is the preceding level of C: \WS4\LETTER.
Removing directories—RMDIR (RD)
Only empty directories may be removed, First you have to remove all the files in the
directory using DEL or Erase command. You cannot delete the root directory.Syntax: RMDIR [d:]path or RD [d:]path
Examples
RD C: \WP\LETTERS—Deletes the subdirectory LETTERS.
If the given RD command is not valid the following message may be displayed.
Invalid path, not directory, or directory not empty.
Either one of the names you specified was not a directory or was the current directory
(which you cannot remove) or the directory you are trying to remove still contains files or
subdirectories. For this you have to either check the directory name, change to a different
directory, or delete the contents of the directory and then reissue the RD command.
Changing the system prompt—Prompt
Allows you to change the system prompt.
Syntax: PROMPT [prompt]
Options
‘The prompt can be any literal message displayed on the screen, and it can include any one
of the following special characters.
$t Current time
$d Current date
$n Default drive
$p Current path
$v DOS version number
$g Greater-than character (>)
$1 Less-than character (<)
$b Vertical ber (1)
$q Equal sign (=}
$- Starts a new line (enters carriage-return/line feed se-
quence)
$h Backpaces and erases last character
$e ESCAPE character (ASCII 27)
Examples
Prompt $t $b $d $n $g
BEFORE: A>
AFTER : 12:09:33:55 | THIS 9-10-87 | A>
Prompt Dos
BEFORE : A>
AFTER : DOS
Prompt $p$G
BEFORE: C>
AFTER> C: \WS4\LETTER
Enter PROMPT (with no prompt string) to return to the default prompt.EXTERNAL COMMANDS
All external commands can be preceded by a drive name and path at which
it is available.
Formatting Disks—Frormat
Prepares a disk by rearranging random magnetic impulses into a series of tracks and sectors
so that is it addressable by DOS.
Syntax: [d:] [path] FORMAT fd: (/s] (/u] [/4]
Options
/s~Transfers DOS system files into the disk being formatted.
/u-Unconditional formatting to the disk.
/4-Formats a single or double sided disk in a 1.2 MB high-capacity drive.
Examples
FORMAT B:—Formats the disk in drive B.
FORMAT B:/S—Places the DOS files on the disk in drive B and makes it a system disk.
Hence the disk may be used as a bootable disk. While formatting the disk you may get any
one of the following messages:
Disk Unsuitable for system disk
If there is a defective track in the area that contains the DOS files, you will get the above
message. Use this disk only for storing data and not as a bootable disk.
Format failure
The disk may be unusable. Reissuse the FORMAT command using another disk.
Invalid media or Track 0 bad-disk unusable
Either track 0 is bad, in which case the disk is unusable, or the disk and the drive are not
compatible. Check the disk and drive; if they are incompatible types, reissue FORMAT with
the /4 option; if they are compatible, use a new disk.
Copying system files to another disk-sys
The DOS hidden system files cannot be copied by Copy command. For this you have to
use SYS command.
Syntax: [d:] [path] sys cd:
Examples
SYS B: Copies the DOS files to the disk in drive B.
Messages
No room for system on destination disk
This message will be displayed if there is not enough space for the system files on the
destination disk.No system on default drive
If DOS cannot locate the system files to be transferred, the above message will be
displayed. Select a disk that has the DOS files and try again.
Checking the disk-Chkdsk
Reports disk size, space available, and RAM available. Also reports and optionally corrects
internal disk errors.
Syntax: (d:] [path] CHKDSK [cd:] [cpath] [cfilename] [/f] (/v]
Options
/£-Fixes errors in the file allocation table (FAT).
/v-Provides file names as it examines them so that you can see where the error occurs.
Examples
Chkdsk—Checks the default drive reporting any internal errors as well as disk size, free
space, and available RAM size.
Chkdsk B:/F-Checks the disk in drive B while fixing any internal errors it finds. You
will be asked whether you wish to recover any lost data sectors into data files. If you
respond Y, each lost allocation unit is recovered into its own file, named FILEnnnn.CHK.
You can inspect the recovered units by using the TYPE or DEBUG command. If you
respond N, each allocation unit will be made free and hence the free bytes of disk will
increase.
Copying disks—-Diskcopy
Copies disks; optionally formats the target disk if it is not formatted previously.
DISKCOPY cannot be issued to virtual disks such as the one formed by a SUBST
command. This cannot be issued for copying hard disk to floppy disk.
Syntax: [d:] [path] DISKCOPY [sd: [td:]][/1] [/v]
Options
/1-Copies only the first side of the double sided disk
/v-Verifies that the information is copied correctly
Examples
Diskcopy A: B:—Copies the disk in drive A onto the disk in drive B.
Diskcopy—Copies the disk in the default drive to another disk that will be placed in the
default drive.
You have to note that if the target disk has some files already, then those will be erased
automatically during this process. This command will copy all the information available
from the source to target disk, including the hidden files and subdirectories. Any one of
the following messages may be displayed while using this command.
Copy Complete
Copy another (¥/N)?If the copying was done perfectly, the above message will be displayed. To continue the
disk copy process for another disk, you have to press Y; otherwise you have to press N.
Formatting while copying
If the target disk is not formatted previously then this command will format the disk
automatically. During that time the above message will be displayed.
Target diskette may be unusable
If the target disk is having any unrecoverable read, write or verify errors, the above
message will be issued.
Displaying directory tree—Tree
Sometimes you may have to see only the directories available in the disk. If you give DIR
command, you will also get the file names along with the directory names. Hence TREE
command can be given to see only directories.
Syntax: [d:] [path] TREE [pd:] [/F]
Options
/ Displays all the file names within each subdirectory.
Printing files—Print
Allows you to set up a print queue for printing files while continuing to work in DOS.
Syntax: PRINT [/C]{/T] [d:] [path] [filename]
Options
/C-Specifies which file or files are to be removed from the print queue. The preceding files
and all subsequent file names on the command line are cancelled until a /P parameter is
encountered on the command line.
/-Removes all files from the print queue.
Example
PRINT *.BAS—Prints all the files with secondary name (extension) as .BAS one by one.
PRINT A: SALES.BAS—Prints the file SALES.BAS from drive A.
You have seen some of the important commands of DOS. These commands may be
frequently used in your computer operations. The rest of the commands can be learnt with
the help provided by DOS. The help text about any DOS command may be obtained by
typing the command followed by /?