Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Unit 2.4 MS-DOS Concepts and Commands

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 11

Introduction to Microsoft Disk Operating System (Ms-DOS)

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.

3. COMMAND.COM (Command Processor): It is also called command interpreter. It is the


program that displays the system prompt and handles user interface by executing the command
typed in by the user using keyboard.
WHAT IS THE DOS BOOT SEQUENCE?

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.

4. Bootstrap loader first loads the IO.SYS file. After this, MSDOS.SYS file is loaded


which is core file of DOS operating system.

5. After this, MSDOS.SYS file searches to find Command Interpreter


in CONFIG.SYS file and when it finds, it loads into memory. If no Command Interpreter
specified in the CONFIG.SYS file, the COMMAND.COM file is loaded as default
Command Interpreter of DOS operating system.

6. The last file is to be loaded and executed is the AUTOEXEC.BAT file that contains a


sequence of DOS commands. After this, the prompt is displayed, and we can see drive
letter of bootable drive displayed on the computer system, which indicates that operating
system has been successfully on the system from that 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.

2. Hot or Warm Booting –


Hot booting is done when computer system comes to no response state/hang state.
Computer does not respond to commands supplied by user. There are many reasons for
this state, only solution is to reboot computer by using the Reset button on cabinet or by
pressing a combination of ALT + CTRL + DEL keys from keyboard.

ACCESSING MS-DOS

3 ways to accessing MS-DOS:


i) Using Start Menu: Start->Right click->Programs->Accessories->Command prompt or
ii) Using Start Menu: Start->Right click->Command prompt or
iii) Run Command: Start-> Right click->Run->Type cmd in open box

A Command prompt will appear in the command window like below:


C:\>
This symbol is known as C drive or C-prompt.
similarly, A:\> is called A-prompt or A drive. Generally, A:\ is used as floppy drive i.e. when we are
working on floppy disk and C:\ is used for local disk or hard disk. A small blinking bar we see on
the screen. This is cursor. It is waiting for your instruction. There few predefined words for DOS.
These are known as DOS-Commands. Our operating system can understand only these predefined
commands.
These DOS-Commands are divided into two parts.
1. Internal Commands
2. External Commands

FILE & DIRECTORY

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

1. File name or Primary name


2. Extension or Secondary name

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

Changing Default Drive


To change a default drive type the new drive letter followed by colon (:) and then press Enter. For
example, if the default drive is A and you type C: and press Enter, DOS selects drive C: as the default
drive. DOS confirm this by changing the prompt to C:\> or a similar message. If you enter a drive
letter that does not exists in your PC, DOS displays a message “Invalid Drive Specification”.

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.

a) General purpose commands b) File related commands c ) Directory related commands

1. CLS 2. DIR 3. VER

4. VOL 5. DATE 6. TIME

7. COPY CON 8. TYPE 9. COPY

10. REN 11. DEL 12. MD

13. CD 14. RD

a) General purpose commands

1. CLS:- (Clear the screen) This command is used to clear the screen or wipe out everything written on the screen.

Syntax:- C:\> CLS and press Enter

2. DIR:- (Directory) Dir command is used for listing files and directories present in the current directory.

Syntax:- C:\> DIR [/switches]


Example:- C:\> DIR /P

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

Volume in drive C has no label.


Volume Serial Number is 60C5-CAB4

Directory of C:\

05/28/1998 02:52 AM 975,608!!TALLY.EXE


04/12/2006 04:51 AM 0 AUTOEXEC.BAT
04/12/2006 04:51 AM 0 CONFIG.SYS
04/22/2006 02:37 PM 10 csb.log
04/26/2006 11:34 AM 0 DelUS.bat
04/12/2006 04:56 AM <DIR> Documents and Settings
04/15/2006 12:40 AM 1,580 INSTALL.LOG
04/22/2006 03:37 PM 47,564 ntdetect.com
04/22/2006 03:37 PM 250,032 ntldr
04/26/2006 11:34 AM <DIR> Program Files
04/26/2006 03:54 PM 0 T.TXT
04/14/2006 04:13 AM <DIR> TALLY
04/24/2006 01:45 PM <DIR> WINDOWS
9 File(s) 1,274,794 bytes
4 Dir(s) 4,803,510,272 bytes free

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

5. DATE:- Display the current Date


Syntax:- C:\> DATE
C:\>DATE
Current date is Fri 02-15-2002
Enter new date (mm-dd-yy):

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.

6. TIME:- Display current time


Syntax:- C:\> TIME
C:\>TIME
Current time is 8:38:47.70a
Enter new time:
Type TIME without parameters to display the current time setting and a prompt for a new one. Press
ENTER to keep the same time.

Note:- We enter the time in the format of 24 hour clock.

b) File related commands:


Creating a new file
Viewing the existing file
Copying one file to another
Renaming a file
Deleting a file

7. COPY CON:- This command gives the facility to create a new text file.

Syntax:- C:\> COPY CON Filename


C:\>COPY CON class.txt
Good Morning everyone.
Welcome to the new class.
^Z

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.

Notes:- 1. Never forget to give a suitable filename


2. You can use extension as .TXT for denoting the file as Text file.

8. TYPE:- This command is used to display the contents or text of any file to the display device.

Syntax:- C:\> TYPE Filename


C:\>TYPE class.txt
Output:
Good Morning everyone.
Welcome to the new class.

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.

Syntax:- C:\> COPY Source_filename Target_file name


C:\>COPY class.txt bcaclass.txt

1 file(s) copied

TO copy a file from hard disk to any other drive

C:\>COPY class.txt F:\


1 file(s) copied

To copy a file from D drive to Hard disk


C:\>COPY F:\class.txt C:\class1.txt
1 file(s) copied

10. REN:- (Rename) This command is used to change the name of any file or directory.

Syntax:- C:\> REN Source_filename Target_filename


C:\>REN class.txt newclass.txt
If we get successfully C:\ that means filename or directory name is get changed. Either it will show
the error message.

Similarly we can rename the filename present in the other drives also.

C:\>REN F:\ class.txt class1.txt


class.txt is renamed with class1.txt in F: Drive
Note that you cannot specify a new drive or path for your destination.

11. DEL:- This command is used for erasing any file from the disk.

Syntax:- C:\> DEL <Filename>

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

c) Directory related commands


Making or creating a new directory
Change Directory
Rename Directory
Remove directory
Going to one directory back
Going to the root directory

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

16. Going to one directory back


Prompt will change with the directory name. If we keep two dots after CD command than we will exit
from the directory.
Syntax:-C:\> CD..
C:\REPORT> CD ..
C:\>

16. Going to the root directory


Prompt will change with the directory name. If we keep \ after CD command than we will exit
from the current directory and shifted to the root directory.
Syntax:-C:\> CD\
C:\REPORT\VB>CD\
OUTPUT:
C:\>

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.

The '?' wildcard character: stands for single character replacement.


Suppose we want to list out all the files and directories which have file name made of four
characters and extension name is made up of 3 characters. Then here we use DIR command with
following switches

C:\> DIR ????.???

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

C:\> DIR C???.EXE

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

Some Internal commands with wild card


COPY:-If we have to copy the songs from our CD drive to our Hard disk. Then suppose E:\ is our CD
drive and we have to store all the songs in C:\ SONGS directory.
C:\> COPY E:\ *.MP3 C:\ SONGS

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

C:\> DEL *.TMP


If we use /p switch the computer give ask every time before deleting the file. If we enter 'Y' then it
will erase the file from disk either it will leave the file.

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 ATTRIB FIND X CO P Y


SORT TREE MOVE DISKCOPY
S YS CHKDSK LABEL FORMAT
FC

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.

Syntax:- C:\> MORE filename


Or
C:\> TYPE <File name> | MORE
Or
C:\> COMMAND | MORE

C:\> MORE class.txt

C:\> TYPE class.txt | MORE


or
C:\> DIR | MORE

ATTRIB:- Sets the various type of attribute to a file. Like Read only, Archive, Hidden and System attribute.

Syntax:- C:\> ATTRIB [± r] [± a] [± h] <File name>

here r - for read only, a- for archive, h - for hidden attribute.


+ sets an attribute
- Clears an attribute
-
C:\> ATTRIB +r newclass.txt
This command will change the attribute of file newclass.txt to read only mode. To remove the read only
attribute we will follow this command.
C:\> ATTRIB -r newclass.txt
C:\> ATTRIB +h newclass.txt
This command will make the file newclass.txt to hide only mode. To remove the hide only
attribute we will follow this command.
C:\> ATTRIB -h newclass.txt

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.

Syntax:- C:\> XCOPY Source_dirname Target_dirname

C:\> XCOPY TC TURBOC


or
C:\> XCOPY TC F:\TURBOC

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.

Syntax:- C:\> MOVE <file name> <path name>

C:\SONGS> MOVE *.MP3 C:\ SONGS\OLD SONGS\

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.

Syntax:- C:\> FC <First set of file> <Second set of file>

C:\> FC class.txt newclass.txt

CHKDSK:-(Check disk) - This command is used to check the status of a disk and show the report of result status.

Syntax:- C:\> CHKDSK


C:\>CHKDSK

CHKDSK has NOT checked this drive for errors.


You must use SCANDISK to detect and fix errors on this drive.

Volume JAI created 10-19-2001 7:14p


Volume Serial Number is 3E42-1907

4,203,073,536 bytes total disk space


381,988,864 bytes available on disk

4,096 bytes in each allocation unit


1,026,141 total allocation units on disk
93,259 available allocation units on disk

651,264 total bytes memory


610,784 bytes free

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:

This command will be copy all contents of A drive to B drive.

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

FORMAT:- This command creates new Track & Sectors in a disk.


Syntax:- C:\> FORMAT [drive name] [/S]

C:\> FORMAT A:

This command will create new track & sectors.


C:\> FORMAT A: /S
This command will transfer system files after formatting the disk.

You might also like