Unit 2.4 MS-DOS Concepts and Commands
Unit 2.4 MS-DOS Concepts and Commands
Unit 2.4 MS-DOS Concepts and Commands
MS-DOS stands for Microsoft Disk Operating System. Ms- DOS is a single user and single tasking
operating system. An operating system is collection of system programs, used for controlling
input/output operation. It is also known as interface between hardware and user.
An operating system may be considered as the language translator which converts the user’s readable
codes into machine readable codes, means machine level language or binary digits.
It was developed by Microsoft Corporation for IBM PC compatible personal computers during 1980s
to the mid-1990s, until it was gradually superseded by operating systems offering a graphical user
interface (GUI), in particular by various g e n e r a t i o n s of the Microsoft Windows operating
system.
The commands of MS-DOS are not case sensitive. It uses command line interface (CLI) for interacting
with the end users.
Different version of DOS, such as 2.0, 3.0, 3.2, 4.0, 5.0, 6.0, 6.2, 6.22, 7.0, 7.2 are available. The
higher versions have more features and commands.
Booting in MS-DOS
Booting
It is defined as the process of loading the operating system into memory. The booting process
starts from the moment when we power on computer and continues till moment, computer is
ready for use.
When the computer is switched on, the set of programs that are in Read Only Memory (ROM)
also called Basic Input-Output System (BIOS), are loaded into memory (RAM). This process
is known Bootstrapping (Booting). The OS once loaded takes control of the computer, handles
user interaction, and executes application programs.
During Booting process, computer loads the operating system into its memory. DOS booting
involves reading the following files into memory namely IO.SYS, MSDOS.SYS, and
COMMAND COM.
1. IO.SYS (The Basic Input/output Program): This program provides interface between the
hardware devices and software of the system. It takes care of the keyboard input, character
output to monitor, output to printer and time of the day.
2. MSDOS.SYS (The File and Disk Manager Program): It contains the file management and
the disk buffering management capabilities. It keeps track of all the disk access of an
application program and remains permanently in memory.
In the booting process of DOS, the following steps are performed when we start a computer:
1. Once the computer system is turned on, BIOS (Basic Input /Output System) performs
a series of activities or functionality test on programs stored in ROM, called on Power
On Self Test (POST) that checks to see whether peripherals in system are in perfect
order or not.
2. After the BIOS is done with pre-boot activities or functionality test, it read bootable
sequence from CMOS (Common Metal Oxide Semiconductor) and looks for master boot
record in first physical sector of the bootable disk as per boot device sequence specified
in CMOS. For example, if the boot device sequence is –
1. Floppy Disk
2. Hard Disk
3. CDROM
3. After this, master boot record will be searched first in a floppy disk drive. If not
found, then hard disk drive will be searched for master boot record. But if the master boot
record is not even present on hard disk, then CDROM drive will be searched. If the
system is not able to read master boot record from any of these sources, ROM displays
the message “No Boot device found” and system is halted. On finding master boot
record from a particular bootable disk drive, operating system loader, also called
Bootstrap loader is loaded from boot sector of that bootable drive· into memory. A
bootstrap loader is a special program that is present in boot sector of bootable drive.
Types of Booting :
1. Cold Booting
When the user starts computer by pressing power switch on system unit, the operating
system is loaded from disk to main memory this type of booting is called Cold
Booting. This booting takes more time than Hot or Warm Booting.
ACCESSING MS-DOS
Before we go on detail in these commands, let first we understand a term called File and Directory.
A file is an organized collection of data stored on a storage device such as hard disk. Different
types of files are used in computer system such as text file, batch files, database files etc. A file
may be known as container of information on a particular topic.
Files on the hard disk are divided into various segments called Directory. A directory can store any
number of files. It helps to organize our files in an efficient manner. A directory may be considered
as a structure or a cabinet which keeps one or more files. Directories are usually creating for
keeping one or more identical files together.
Every file has a filename which helps to recognize them. these are divided into two parts
The primary name can be from 1 to 8 characters long. The extension contains 1 to 3 characters long.
A filename and extension are separated by using a dot symbol. Thus, its structure looks like
Filename . Extension
The valid characters for giving a file name are from A to Z and the digits are from 0 to 9. Special
symbols are ~ ^ % # @ ! _ - { } [ ] ' `.
Extensions are usually used for denoting the type of files or the type of information stored in the file.
Like the filename have extension EXE, BAT, COM are respectively Executable, Batch and Command
files, which are given high priority by DOS. Because these files could be directly understood by
operating system. Similarly, the filename having extension BMP, GIF, JPEG etc. are the extension for
graphical files. The files having extension C or CPP are the files of C/C++ language, BAS for BASIC
language, PAS for PASCAL programming and so on.
The directory is further classified into 3 parts:
a) current directory b) sub-directory c) root directory
Some examples of invalid file names are:
Filename Reason
SALE 2 Contains space
PROGRESSER Contains more than eight characters
MY, File Contains commas
CHAP_01.DOC3 Extension name contains more than 3 characters
1. INTERNAL COMMANDS
These commands are automatic loaded into the memory when operating system is loaded into the
memory. Thus, these are also called memory-resident commands. The commands available are all
combined together and are stored in Command.com file, which is an executable command file.
These internal commands are further grouped according to their properties. These are as follows.
13. CD 14. RD
1. CLS:- (Clear the screen) This command is used to clear the screen or wipe out everything written on the screen.
2. DIR:- (Directory) Dir command is used for listing files and directories present in the current directory.
Switches:-
/P Page wise
/W Widths wise
/S List all files and directory of subdirectories
/AH Display directory with hidden files
/AS Display directory with system files
/AD Display only directories present in current drive
Directory of C:\
3. VER:-(Version) Version numbers indicates that which edition of DOS we are working on.
Syntax:- C:\> VER press enter
C:\>VER
Output
Windows 98 [Version 4.10.2222]
4. VOL:-(Volume) Displays the disk volume label and serial number, if it exist.
Syntax:- C:\> VOL press enter
Output:-C:\>VOL Volume in drive C is JAI
Volume Serial Number is 3E42-1907
Type DATE without parameters to display the current date setting and a prompt for a new one. Press
ENTER to keep the same date.
Note:- We enter new date in the format of MM-DD-YY.
7. COPY CON:- This command gives the facility to create a new text file.
1 file(s) copied
After copy con we must specify a suitable file name. Press enter. Start typing the informations of the
file. After gathering the information we press ^Z (CTRL+Z) button or F6 button to save the file. After
pressing enter key computer will show a message like 1 file(s) copied. This means that file is stored in
the disk. Suppose we don't want to save the file or we just want to abort from file creation job, then we
simply press ^C (CTRL+C) button to abort without saving the file, intend of pressing ^Z button.
8. TYPE:- This command is used to display the contents or text of any file to the display device.
9. COPY:- Copy command is used for copy any file to another location or to copy the files to
another directory. This command may also be used for copying any file to another disk with different
file name.
1 file(s) copied
10. REN:- (Rename) This command is used to change the name of any file or directory.
Similarly we can rename the filename present in the other drives also.
11. DEL:- This command is used for erasing any file from the disk.
C:\>DEL newclass.txt
If it successfully erase the file from disk then C:\> prompt will be appear, otherwise computer
will show an error message.
Note:- /P option is used for permission before deleting the file.
C:\DEL/P newclass.txt
12. MD:- (Make Directory)- This command allows to create a new directory.
Syntax:- C:\> MD <Dirname>
OR
MKDIR <Dirname>
C:\> MD REPORT
C:\>
Now this directory can be used for keeping various sort of reports. Under this directory we can
create another directory which is known as subdirectory.
13. CD:- (Change Directory):- We can enter or exit from any directory using this command.
Syntax:- CD <Dirname>
OR
CHDIR <Dirname>
C:\> CD Directory_name
C:\> CD REPORT
C:\REPORT>
14. Rename: (Rename Directory): This command is used to rename the existing directory name.
Syntax:- C:\> Rename old_directory_name new_dirctory_name
15. RD:-(Remove directory):- This command is used when we want to remove any unusable directory
from our disk.
Syntax:- C:\> RD Directory_name
C:\> RD REPORT
Wildcard Characters
Wildcards are those characters which can serve as replacement entries for a single or set of characters.
They ar used when we are working with multiple files instant of a single file at a time. DOS supports
2 wildcard characters: '?' (question mark) and '*' (asterisk) symbol.
Here '?' symbol represents that ‘?’ can be any single character or it may be special symbols.
Suppose we want to list out all the files which file name made of 4 characters, the first character
start with 'C' and extension is 'EXE'. Then we use
The '*' wildcard character: stands for replacement of any number of characters.
If we want to list all the files with extension .EXE then the command for that is-
C:\> DIR *.EXE
If we want to display all files with first character 'D' and extension 'EXE' in floppy disk, then we give
the command
C:\> DIR A: D*.EXE
REN:- If we want to rename all the files which have extension of 'TXT' to extension 'MSG' then we
give the command
C:\> REN *.TXT *.MSG
DEL:- If we want to erase those files which have the extension of 'TMP' from our disk then we uses
the command
2. External commands
External commands are known as Disk residence commands. Because they can be store with DOS
directory or any disk which is used for getting these commands. Theses commands help to perform
some specific task. These are stored in a secondary storage device. Some important external
commands are given below-
MORE:-Using TYPE command we can see the content of any file. But if length of file is greater
than 25 lines then remaining lines will scroll up. To overcome through this problem we uses MORE
command. Using this command we can pause the display after each 25 lines.
ATTRIB:- Sets the various type of attribute to a file. Like Read only, Archive, Hidden and System attribute.
XCOPY:- When we need to copy a directory instant of a file from one location to another the we
uses xcopy command. This command is much faster than copy command.
MOVE:- Move command is used for moving one file or multiple files from one location to another
location or from one disk to another disk.
SORT:- This command is useful when we want to sort a file. When we run this command the result
can be get to display device or file.
Syntax:- C:\> SORT /R < Input file name> <output file name>
Suppose we have a file Player.txt which having the list of a cricket player team and we want to sort the
list of players, then we uses this command
C:\> SORT Player.txt
If we not specify the output file name then result will show to the screen.
/R- switch is used for sorting the file in descending order like from Z to A or from 9 to 0.
FC:-(File Compare) This command is capable for comparing two set of files and display difference between two
files.
CHKDSK:-(Check disk) - This command is used to check the status of a disk and show the report of result status.
Instead of using CHKDSK, try using SCANDISK. SCANDISK can reliably detect
and fix a much wider range of disk problems.
FIND:- The FIND command is used to search a file for a text string. Syntax:- C:\> FIND "String to search" <File
name>
C:\TEST>find "welcome" class.txt
---------- class.txt
Welcome to the new class.
10. DISKCOPY:- DISKCOPY copies the contents of a floppy disk to another. Syntax:- C:\> DISKCOPY <Drive1>
<Drive2>
C:\> DISKCOPY A: B:
LABEL:- If you are not happy with the volume label of hard disk, you can change it.
Syntax:- C:\> LABEL
C:\>LABEL
Volume in drive C is JAI
Volume Serial Number is 3E42-1907
Volume label (11 characters, ENTER for none)? INFOWAY
C:\> FORMAT A: