Sie sind auf Seite 1von 38

Introduction to MS-DOS

Microsoft Disk Operating System


Introduction to the Operating Systems:
An Operating system is software that creates a relation between the User, Software and
Hardware. It is an interface between the all. All the computers need basic software known as
an Operating System (OS) to function.

The OS acts as an interface between the User,

Application Programs, Hardware and the System Peripherals. The OS is the first software to
be loaded when a computers starts up. The entire application programs are loaded after the
OS. Whenever an application needs information it requests the OS which in turn queries the
System clock on the motherboard. User interacts with the computer through the OS then OS
interprets inputs given by a user through the Keyboard, Mouse or other input device and takes
appropriate actions.
An Operating System can be of Three Types:
Single User

MS-Dos, MS-Win 95-98, Win-ME

Multi User

UNIX, Linux, XENIX

Network

Novel Netware, Win-NT, Win-2000-2003

1. Single User:

If the single user os is loaded in computers memory; the computer

would be able to handle one user at a time.


2. Multi user:

If the multi-user os is loaded in computers memory; the computer

would be able to handle more than one user at a time.


3. Network:

If the network os is loaded in computers memory; the computer would

be able to handle more than one computer at time.


Command Prompt Interface:
Operating System provides a text based interface called command prompt. From the
command prompt commands can be issued to perform file and disk management and to run
program. Results of these commands are presented to the user as text message.

C:\>The command prompt can be an alphabet followed by one colon (:), one back slash (\), one
greater than sign (>) and one blinking element called cursor (_).

Page 1

Introduction to MS-DOS

Where C:

represents the Drive letter (Current Drive)

represents the current folder / Directory

>

represents the end of the Prompt and

blinking element (represents the Cursor)

Always a cursor position decides that the current typed letter from the keyboard will appear on
that position.
The operating system (OS) is the first program that must be loaded into the memory of your
PC before you can use it for any application. You can start your computer with disk operating
system (DOS) or some other operating system such as Windows 95, 97, 98 or Windows NT
that might be installed in the Hard disk. In this chapter, we shall discuss the basic facilities
available in DOS. Switch to MS-DOS and go through most of the text given in this and the
next two chapters. If your computer is running under windows 95/98 or Windows NT, perform
the following steps to switch to MS-DOS, otherwise move to section 2.1.

Click the start button in the taskbar and press the windows logo key to open the start
menu then click programs in the start menu.

Windows displays the program submenu.

In the program menu click MS-DOS Prompt and your screen displays a window that
contains MS-DOS Prompt, such as C:\windows>_.

Page 2

Introduction to MS-DOS

If you like you can also restart your computer in MS-DOS mode by using the following
steps:
o Close any open programs
o Click the Start Button in the TaskBar or Press the Windows Logo Key to open
the Start Menu.
o Click restart in MS-DOS Mode and then click OK.
Wait for some time and your PC restarts in MS-DOS Mode.

After your PC starts in MS-DOS Mode or window, skip the next section and move to section
2.2.

Loading Disk Operating System (DOS)


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. However, the basic commands and
features are available in all versions. You can load DOS prompt the floppy disk drive or Hard
Disk Drive. Loading the Operating System on a computer is also called Booting of the
computer. Complete the following steps to load DOS in your PC.
To Load DOS from Hard Disk:
To Load DOS from the Hard Disk of your computer, follow these steps:
1. Turn on the power ON/OFF switch of the CPU unit of your PC the power ON/OFF
switch is usually located in the front or the rear of the CPU unit.
2. If your VDU display unit (Monitor) has an ON/OFF switch, turn that switch ON too.
3. Do not put any Diskette is drive A:
Wait for some time your PC perform a Self Test and loads DOS.
Your monitor displays C> or C :\> _ and a DOS prompt message.
To load DOS from Floppy Disk:

Page 3

Introduction to MS-DOS
If DOS is not installed on the Hard Disk of your PC, or you want to load DOS from the Floppy
disk drive due to any reason, follow these steps:
1. Put the DOS diskette in drive A:, Close the drive door if required.
2. Turn on the power ON/OFF switch of the CPU unit of your PC the power ON/OFF
switch is usually located in the front or the rear of the CPU unit.
3. If your VDU display unit (Monitor) has an ON/OFF switch, turn that switch ON too.
Wait for some time your PC perform a Self Test and loads DOS.
Your monitor displays A> or A :\> _ and a DOS prompt message.
Resetting the Computer:
Sometime you may have to reset your computer (i.e., Reboot DOS) while it is still running
because DOS does not work properly. To reset your computer you have two options:
1. Press and hold Ctrl and Alt keys and Press Del. Then release all keys restarting PC
without switching OFF the power is called Cold Booting.
2. Press the Reset button that is usually located in the front of the CPU unit. This
kind of Booting is called Warm Booting.

System Prompt:
On loading (or Switching to) DOS, the screen displays C :\>, C>, A :\> or a similar message.
The message displayed by DOS is called DOS Prompt or System Prompt. This prompt serves
two purposes:
1. It indicates that DOS is ready to accept a command from the keyboard.
2. It displays the default drive name. For instance, C>, C :\>, indicates that drive C: is
a default drive. DOS will use the default drive for all file operations if the user does
not specify any drive name with commands.

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

Page 4

Introduction to MS-DOS
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.
When you select a floppy drive as the default drive, make sure that there is a diskette is
inserted in that drive. Otherwise, DOS gives the following message:
Not ready reading drive A
Abort, Retrieve, Fail ?
If you get this message, insert a diskette in the floppy drive and then press r to Retrieve.

What is a File?
In computer terminology, file is a collection of text or data stored on a storage device, such as a
Floppy Disk or Hard Disk. If you new to computers, it may sound a bit complicated. Well, a
computer file is not much different from a conventional paper file that you must have used, or
at least seen being used. Just as you stored different types of documents (invoice, letters,
reminders, memos etc.) in conventional files, computer files too store information.
File Name
Each file is given a name so that it can be referred to later. This name is called Filename. The
filename in DOS can be up to eight alpha-numeric characters long. Optionally it can also have
a period (.) followed by an extension name. The extension name the up to three characters
long. For instance, consider the following filename:
REPORT2
PROGRESS.DOC
Here REPORT2 is a filename. This filename does not have an extension name DOC. The
use of an extension name in a filename is optional. However, the extension name helps in
organizing and identifying a file. For instance DOC may suggest that it is a document file;
and COM may suggest that is a command file. If you use an extension name with a filename,
normally you will have to specify the complete file name, normally you will have to specify
the complete file name (i.e. including the extension name) while using it with DOS commands.
While naming files, you can use the following characters in filename:
A- Z, a- z, 0 9, @, #, $, %, ^, &, -, _, { },`, ~,( )

Page 5

Introduction to MS-DOS
You cannot use other characters, such as coma (,) colon (:), semicolon (;), <, >, \, /, etc. in
filename. Moreover, you cannot use space in filenames. Some examples of invalid file names
are:
Filename

Reason

SALE 2

Contains space

PROGRESSER

Contains more that eight characters

MY, File

Contains commas

CHAP_01.DOC3

Extension name contains more than 3 characters

If you use more than eight characters in the filename or more than three characters in the
extension name, DOS may automatically truncate the filename by removing extra characters.
Further, some file names, such as COM 1, COM 2, LPT1, com and PRN are reserved by DOS
for its own use. Therefore, do not use these names to name your file. Also, remember that all
DOS application programs including Word, Excel, WordStar, Bbase III PLUS AND Fox Pro
follow the same file naming convention.

WHAT IS A Directory?
As you know, the storage capacity of the hard disk is usually quite large (10 MB to a few GB).
You can store hundreds or even thousands of files in your hard disk. Even the capacity of a
floppy disk is large enough to store many files. A directory is nothing but a named section of a
storage device, such as hard disk, floppy disk. In other words, to organize file on hard disk or
floppy disk, these are divided into various segments (sections), called directories. You can store
any number of files in each directory. The directory helps to organise your file in an efficient
manner. Using directories in a storage devise is similar to keeping different types of files in an
office in separate drawers of a filing cabinet. For instant, Xyz Company may keep all sales
files in the first drawer, all purchase files in the second drawer and all employees files in the
third drawer of a filing cabinet. In the same way, when XYZ Company computerizes its
operation, it may store all sales files in the SALES directory, all purchase files in the
PURCHASE directory and all employees files in the EMPOLYEES directory. Similarly, the
user Raj Kumar may keep his personal files in the RAJ directory and the secretary of XYZ
Company may store the letters in the LETTERS or DOC directory.

Page 6

Introduction to MS-DOS
Dirve C
<root directory>
Files:
AUTOEXEC.bat
Config.sys
Ranjan.doc
Rajan.bak
Seema2

Diretory
<word>
Files:
word.exe
word.hlp

Files:
Excel.exe
Excel.hlp

Directory
<excel>
Directory
<tender>
contains file

Directory
<employee>
contains files

Directory
<sales>
contains files

Like a file name, the directory name can also have up to eight alpha-numeric characters. The
directory name can also have and extension name up to 3 characters long. However, normally,
the extension name is not used with the directory name.
When you start your PC, it usually responds with C :/> and selects the main or the root
directory of drive C. Any file that you create or copy to drive C is added to this root directory.
If you continue to add files in the root directory, after a few days, the root directory will have
too many files. This will not only confuse you, it will also make the PC slow. The PC may take
too long to locate or open the files if there are too many files in a directory. There for you
should try to use directories (and sub directories) in your hard disk
DOS always creates a root directory in each story device. You can create new directories in the
root directory of the hard disk or floppy disk. You can store files in these directories. Moreover,
beside files, each directory can also have directories. Those, the file and directory organization
in DOS looks like the roots of a tree, as show in figure 2.1.here, the root directory in drive C
contains if you files in two directories WORD and EXCEL. The WORD directory contains a
few files as well as a directory TENDER. Sometimes, the second level directory (TENDER in
this case) is called sub-directory. The root directory contains another directory EXCEL. This
directory contains a few files as well as two directories SALES and EMPLOYEE. Both these
directories contain files.

Page 7

Introduction to MS-DOS
At any level in the directory structure, can be created. For example, another directory, say
FOXPRO directory may contain files as well as more directories. If you want, you can remove
files from any directory or more files to another directory. You can also delete an enter
directory. Comments to copy, move, rename and delete files and to create and change
directories are discussed letter in this chapter. Additional file and directory comments are
discussed in the next chapter.
Displaying the List of Files with DIR
You can display the list of files stored in a diskette or hard disk with the DIR commend. This
Commends list files and sub directories in a disks directory on the screen. Beside the file name,
DIR also list other details about files, such as files size (in bytes) and date and time of
creation/last up date of files. It also displays the number of files listed, total bytes occupied by
the listed files as well as free space available on the disk. Let us list files from the current
(default) drive.
Against the prompt message (A>or C :\>) type DIR and press Enter.
Your monitor displays the information similar to that shown in figure 2.3
The DIR command displays the list of files present in the default drive. In the directory listing,
the first column indicates files and directories present in the disk. Notice that DOS displays <
DIR > against directories. If your disk has no directories, (your DOS disk may not have any
directory), you will not get any <DIR > entry in your list. For all file names, DIR also displays
extension names, it used. DIR also displays size and date and time of creation or last update for
all files and directories. At the end of the list, it shows the number of files listed, bytes used in
these files and bytes remaining on the disk.
Options with DIR
You can use several options with DIR.
To get the list of files from some other drive, specify the drive name followed by : with DIR.
For instance, if drive C is the default drive and you want to get list of files from a disk in drive
B, type DIR C: and then press enter key.

To get summary of the directory listening, use/ W after DIR, e.g. DIR/W or DIR C: /W. with
the /W option, DOS displays only the file names. It does not display file size and date/ time
of creation/ modification of files.

Page 8

Introduction to MS-DOS

Volume in drive C has no label.


Volume Serial Number is 60C5-CAB4

If the directory listening

Directory of C:\
05/28/1998
04/12/2006
04/12/2006
04/22/2006
04/26/2006
04/12/2006
04/15/2006
04/22/2006
04/22/2006
04/26/2006
04/26/2006
04/14/2006
04/24/2006

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

is too long to fit on the


screen, it scrolls up on
the screen so fast that
you may not be able to
read

it.

In

such

situation, you can use


/P option with DIR to
get

the

directory

listening page wise. For


instance, you can try
DIR /P or DIR A: /P. Now, it will display the first page of the directory listening and pause.
You can take your time to read the list.
When you want to see the next page of the directory listening, press any key.
Sometimes you may like to find out if a particular file is present in a disk. In that case, you can
specify that file name after the DIR commend. For instance, consider the following commend:
C:> DIR RAMA
In response to this commend, DOS will check if any files having the file name RAMA exist
(regard less of the extension name). If so, it lists them. For instance, if drive C contains two
files-RAMA. Doc and RAMA.bak, the DIR RAMA command will list both of them along with
the file size and date and time of last update of these files. If there is no file with the specified
filename on drive C, DOS displays a message file not found.
Sometimes you may like to list files having similar names. For example, you may have named
files containing chapter of a book as CHAPTER.1, CHAPTER.2, CHAPTER.3, etc. Let as

Page 9

Introduction to MS-DOS
assume that these files are available in a root directory of drive C. now if you use the command
DIR C: CHAPTER.*, it will list all files from drive C that have the name CHAPTER.
Similarly, to list all .DOC files from the current drive, you can use the command DIR
*.DOC. the character * used in these commands is called the wildcard character. This
character selects any name (where * is used) in the command. In the first DIR command (DIR
C: CHAPTER.*) it will select any extension name. in the second command (DIR *.DOC), *
selects any file name having .DOC extension name. the * wildcard character can also be
used in another way. Consider the command DIR WCHAP*. This command list all file
names that begin with WCHAP from the current drive. For instance, it will list filenames, such
as WCHAP1, WCHAP 10.DOC, WCHAP_A.BAK, etc.
You can also use another wildcard character ?.
C:\> DIR sale?rep
This command will list filenames, such as SALE1REP, SALESREP, SALE_REP.bak, etc. that
is, it will accept any character at the position of ? in the DIR command.
The Dir command can also be used to list files from the particular directory. For example, the
list of files available in the WORD directory in drive C, you can use the following commands.
DIR C:\WORD
DIR \WORD
The first command specifies the drive & directory name with DIR command. The second
command does not specify the drive name In he command, Dos ill use the default drive. There
fore command will show list of file from the WORD directory in drive C only if drive C is the
default drive. Otherwise, it will try to locket the WORD directory in the default (current) drive.
In both these commands, \ refers to the root of the top level directory in the default or the
specified drive.
Similarly, if you want to get the list of file from the EXCEL directory, you can use the
command DIR C:\EXCEL. Now consider another case. We want to list files from the SALE

Page 10

Introduction to MS-DOS
directory (refer to figure 2.1). If you look carefully at the directory structure show in figure 2.1,
you will notice that the Sales directory under the EXCEL directory, you need to specify the
complete path for it with DIR command. The compute path for the SALES directory in shown:
Thus, you can use the commend DIR C:\EXCEL\ SALES to list files from the SALES
directory. Here, C:\EXCEL\ SALES is the path for the files stored in the SALES directory. The
path for any file includes all directories locked above that file in the directory free structure.
The path also includes he drive name and the root directory. The root directory is referred to by
\ immediately following : after the drive letter, e.g. C:\. If the path includes multiple
directories, separate these directories with \. Also, do not use any space in the path. For
instance, DIR C:\EXCEL \SALES is invalid.
To list files from the root directory of the current drive, you can use the commend DIR \
(remember that the first / after DIR refers to the root directory.)
Changing the Directory
In previous section you learnt to change the drive. Similarly, you can also change the directory.
After changing the directory, the new directory becomes the default directory. For example,
you change the directory to EXCEL in drive C. Now if you use any DOS command (including
DIR) and you do not specify the drive or directory with the command, DOS will automatically
use the C:\ EXCEL directory with the command. To change the directory, you can use the
CHDIR or CD command, e.g.
CHDIR \ EXCEL
CD \ EXCEL
CD C:\ EXCEL
CD C:\ EXCEL\SALES
The first two commands try to select the EXCEL directory in the current drive. If the system
prompt is C :>, C :\> or starts with C: drive is the default drive. In that case, these commands
will try to select the EXCEL directory at the root level in drive C. If the EXCEL directory
exists in the default drive, DOS will select it. Otherwise, it will display the message invalid
directory. The next command, i.e. CD C:\ EXCEL too tries to select the EXCEL directory in

Page 11

Introduction to MS-DOS
drive C. Notice that this command uses the complete the path, including the drive name. The
last command tries to selects the SALES directory under the EXCEL directory from drive C.
Remember that if you want to change the directory in a drive other that the default (current)
drive, you must the specify the complete path, including the drive name (letter) with CHDIR or
CD. For instance, if your screen displaying A :>, A :\> or a similar prompt and you select
the word directory in drive C, use any of the following commands.
CHDIR C:\WORD
CD C:\WORD
However, if you want to select the directory in the current drive, you may omit the drive name.
After change the directory to WORD, if you use the DIR command, DOS displays the list of
files from the WORD directory.
To select the root directory in the drive (regardless of the currently selected directory), you can
use any of the following commands:
CHDIR \
CD \
Changing the System Prompt
When you change the directory, you would like to keep track of it. The best way to do this is by
displaying the name of the current directory along with the drive name in the system prompt. If
youre PC does not display the directory name after the drive name in the system prompt, you
can use the PROMPT command to display it. For instance, consider the following command:
C>PROMPT $P$G
If you use this command, DOS display the directory name after the drive name. The system
prompt change to C :\>, A :\>, etc. if a directory is a selected in the drive, DOS also includes
that in the system prompt. For example, if the WORD directory is selected in drive C, the
system prompt changes to C:\WORD>.

Page 12

Introduction to MS-DOS
The prompt command can also be used to display additional information in the system prompt.
For instance, you can display the current date and/or time. Consider the following commands:
PROMPT $P $D $G
PROMPT $P $T $G
The first command displays the current date along with the path of the selected directory in the
system prompt. The next command displays the current time along with the selected directory
in the system prompt.
Creating a New Directory
You can create any directory under any directory in the hard disk or floppy disk. The command
to create a new directory is MKDIR or MD. To create a new directory, go through the
following steps:
1.

Select the drive where you wish to create a new directory.

2.

If you want to create the new directory at the root level, select the root directory
with the command CD\ or CHDIR\. Otherwise use the CD or CHDIR command to select
the desired directory where you wish to select the root directory where wish to create a new
directory.

3.

Use the MKDIR or MD command.

If the prompt showing C :\>, type C: and press the Enter key to select drives C.
Type CD\WORD and the press the Enter key to change the current directory to C:\word. Of
course, if your hard disk does not contain the directory c:\word, you would get a message
Invalid Directory.
Copying Files
While using a PC, often you need to copy file from a floppy disk to the hard disk or vice-versa.
For instance, you buy some software and want to load that on your hard disk, in that case, you
may have to copy files from the floppy disk to the hard disk. You may also have to copy files
if you want to transfer file from one computer to another. Moreover, you may want to make
backup copies of you important file on the hard disk to floppy disk into a floppy disk. To copy

Page 13

Introduction to MS-DOS
files from one storage device to another, you can use the COPY command. This command has
the following syntax:
Here, source refers to the path and the filename(s) of the file(s) to be copied. Destination
typically refers to the destination path. I.e. drive name and directory where the files to be
copied. For example, consider the following command:
C :\> COPY C: REPORT A:
This COPY command copies the REPORT file from the drive C to the disk in drive A. after
copying the file in drive A, it will name the new file (in drive A)too REPORT. Now consider
the following commands:
C :\> COPY A: CHAPTER1.DOC C:
C :\> COPY A: CHAPTER1. DOC C:\WORD
The first command copies the chapter1.DOC file from drive A to the current directory in drive
C. as the root directory is selected in drive C(prompt is C:\>), it copies the file to the root
directory in drive C. the next command copies the file to the WORD directory in drive C.
In all examples discussed above the COPY command assigns the same name to the copied file
as the source file name. Notice that in these COPY commands, you did not specify any
filename with destination. That is why the COPY command assigned the source file name to
the copied files. However if you like, you can assign a new name to the copied file for
example,
C :\> COPY C: REPORT A: SALESREP
Will copy the REPORT file from the drive C to drive A and will assign SALESREP as the file
name to the copied file.
The COPY command can also be used to copy several files in one stroke by using wildcards.
For example, consider the following commands:

Page 14

Introduction to MS-DOS

C :\> COPY C:*. DOC A:


C :\> COPY C: SALE?. REP A:
The first COPY command copies all file having the extension name DOC in the current
directory in drive C to a disk in drive A. The second command copies files such as SALE1.
REP, SALE 2. REP and SALE.REP from the current directory in drive C to a disk in drive A.
While using the COPY command (or for that matter, any dos command), if you do not specify
the path, DOS assumes that you are referring to the currently selected drive and directory. For
instance, consider the following command:
C :\> COPY COMMAND.COM A:
C: \ WORD> COPY DASTA 1.DOC A:
In the first command, the drive and directory names are not specified with COMMAND.COM.
However, as drive C is the currently selected drive and the root directory is selected (prompt is
C :\>), DOS assumes that you are referring to the root directory of drive C. Accordingly, it
looks for the COMMAND.COM file in the root directory of drive C. similarly, the next
COPPY command looks for DATA1.DOC file in the WORD directory in drive C, as
C:\WORD is the current directory and no path is specified with the DATA1.DOC.
You can also copy files from a drive and directory other that the currently selected one.
However in that case, you need to specify the complete path for the source file(s). For example,
C :\> COPY D: SAMPLE.TXT A:\
C: \WORD> COPY C:\EXCEL\EMP01.XLS A:\
C: \WORD> COPY C:\EXCEL\EMP01.XLS C:
C :\> COPY \FOXPRO\DATA.DPF A:
The first command copies the SAMPLE.TXT file from the drive D to the root directory in
drive A. the next command copies EMP01.XLS file from the EXCEL directory of drive C to
the current directory, i.e. WORD in drive C. the last command copies the DATA.DBF file from
the FOXPRO directory (at the root level) in the current directory of drive A.

Page 15

Introduction to MS-DOS
While copying files with copy, DOS in encounters any error, it displays a suitable error
massage. The common reason for error massages are:
1. Sours or target drive is not ready.
2. Target (destination) disk is write-protected.
3. Target disk is not formatted.
4. Unable to read files from the source disk.
5. Insufficient disk space on the target disk.
In most case, DOS allows you to correct the error condition and retry the command (by
pressing R). If the drive is not ready, normally, the remedy lies in inserting a disk in a drive and
closing the drive door, if required. If the target disk is the write-protected, you can remove the
write-protect sticker (in a mini floppy disk) or move the write-protect tab in a micro floppy
disk and retry the command. If you are attempting to copy files on a new floppy disk, you will
first have to format the disk. (Formatting discussed in section 2.15). In case of insufficient disk
space on the target disk, the remedy lies in creating vacant space by deleting unwanted files or
by changing the target disk.
When you use the COPY command, if the destination directory already has file(s) that you are
trying to copy, you are prompted to give direction to the system, e.g.
Overwrite A\NEW\SAMPLE.DOC (Yes/No/All)?
You can choose the following:
Yes (Y)

: Overwrites the file and continues the COPY command.

No (N)

: Does not overwrite the file and continues the COPY command.

All (A)

: Overwrite the indicated file and all subsequent files. That is, Suppresses To use

any option, press the corresponding letter (e.g. Y for Yes) and press the Enter key.
Deleting Files with DEL/ERASE
The DEL or ERASE command is used to remove file from a floppy disk or hard disk. For
example, DEL SAMPLE.BAK or ERASE SAMPLE.BAK files from the current drive and
directory. To areas a file from some other drive or directory, you need to specify the path with
the filename. To erase a group of files, you can use wildcards, with filename. Some examples

Page 16

Introduction to MS-DOS
of using DEL or ERASE commands are show in figure 2.4. The last two commands, i.e. DEL
*.* and DEL. Delete all files in the current directory. If you any of these two commands, DOS
displays message:
All files in directory will be deleted!
Are you sure (Y/N)?
Now you can press Y followed by the Enter key to delete all files. If you do not want to delete
all files, press any other key and then press Enter.
Command
Deletes
C:\> Del A:\sample.txt Sample.txt file from the root dir of
drive A
C:\> Del A:\word\*.txt All files having .txt extension from
the word dir of drive A
C:\> Del \word\*.doc All files having .doc extension
from the word dir of the current
drive C
A:\> Erase C:test.doc Test.doc file from the current dir in
drive C
C:\word> del *.* All files in the current dir in word
of the current drive C
C:\word> del .
All files in the current dir in word
Changing Filename with RENAME (REN)
If you need to change the filename of existing files, you can use the RENAME or REN
command.
For example:
C :\> RENAME SAMPLE.TXT NEW.DOC or
C :\> REN SAMPLE.TXT NEW.DOC
Will rename the SAMPLE.TXT file in the current directory to NEW.DOC. If the specified file
dose not exist or the new filename is already assigned to some other file, DOS responds with a
massage, Duplicate filename or file not found. If the file to be renamed exists in some other
directory or drive, you need to specify the complete path with RENAME. For instance.
A:\>RENAME C:\WORD\SAMPLE.DOC NEW, DOC
Renames SAMPLE.DOC in the WORD directory in drive C to NEW. Doc

Page 17

Introduction to MS-DOS
DATE and TIME
DOS maintains the real time calendar clock such that the current date and the time are always
available to software programs. DOS also the uses the real time clock to time-stamp any file
that it or any software program creates or modifies. To see or change the current date, the
DATE command can be used. On using this command, DOS displays the following or similar
message:
Current date is wed 10-09-97
Enter new date (dd-mm-yy):
If you want to change the current date, type the new date followed by enter. If you do not want
to change the date, just press the Enter. Notice that while entering the new date, you have to
take care of the date format. Similarly, you can use the TIME command to see or change the
current time.
Example:
C :\> TIME
Current time is 3:48:20p
Enter new time:
Now you can enter the new time, if required. While entering the new time, you need not enter
time up to the last second. For instance, you may just enter 9.30 if you want to the new time to
be 9.20 a.m.
Internal and External DOS Commands
There are two types of DOS commands- internal and external. The internal commands are
those commands that are automatically loaded in the memory of your PC when DOS is loaded.
These commands can be used without the need of any DOS file or diskette. The internal
commands are simple and are used for common tasks, such as copying, renaming or erasing
files, displaying a list of files in a diskette, creating and changing directories; changing the
current date in your PC, etc. On the other hand, the external commands are used for relatively
complex jobs, such as copying an entire diskette, formatting a diskette; comparing or joining
files, sorting text, etc. The list of internal DOS commands is given in figure 2.5. we have
already used a few internal DOS commands. Now we will use a few additional internal and
external DOS commands.

Page 18

Introduction to MS-DOS
BREAK
EXIT
CLS
TYPE
PAUSE

ECHO
REN(RENAME)
IF
PATH
VER

REM
CHDIR(CD)
COPY
VER
DIR

CALL
RMDIR(RD)
MKDIR(MD)
DEL (ERASE)
VOL

Formatting a Diskette with Format


Normally you have to format all new disks before you can use them. (Sometimes you can also
buy pre-formatted disks.) The formatting of disks is done with the help of the FORMAT
command. The format command does two operations on the disk:
-

Checks the disk surface for bad areas. If it detects any bad area, it marks that area as bad.
DOS will not use that area for storing files.

Initializes the disk to accept DOS files and creates the root directory.

Initializes a disk means writing a pre- defined patron on disk. Different operating system, such
as DOS, UNIX, system 7.5 (Mac), etc store files in different format on the disk. Thus, when
you format a disk, DOS writes a pre-defined patron on the disk. This pattern helps DOS to
verify that the disk is a DOS disk (and not a Unix disk) at the time of storing a file on the disk.
Format is an external DOS command. The DOS file FORMAT. COM is used to invoke the
formatting process. This file is available in your DOS disk, or in the root or DOS directory of
your hard disk. To format a disk in drive A, complete the following steps:
-

Select the directory in your hard disk that contains the file FORMAT. COM. Usually, the
name of the directory that contains DOS files is C:\DOS.

Enter FORMAT A:

Your monitor displays a massage:


Insert new diskette for drive A:
And press enter when ready.
-

Now insert the disk to be formatted in drive A and press the enter key to start formatting.
Your monitor displays the following or similar information:
Checking existing disk format

Page 19

Introduction to MS-DOS
Saving unformat information
Verifying 1.44m
DOS will take some time to format the disk. Then it asks for a volume name (also called
volume label). This name is assigned to the disk. DOS displays the name when you use DIR
to get the list of files on the disk. You can enter up to 11 alphanumeric characters for the
volume name. The volume name may be useful in identifying a disk. Therefore, always
assign a meaningful volume name when you format a disk.
It then displays the formatted capacity of the new disk, e.g.
1,457, 664 bytes total disk space
1,457, 664 bytes available on disk
If the two numbers are same, it indicates that the disk is 100% okay and all storage area is
available for storing files. However, if the disk that you have formatted is not 100% good,
you also get a massage, such as 15360 bytes in bad sector. This does not mean that the disk
is unusable. All it means is that so much area of the disk is bad and is not available is storing
files. DOS automatically skips that area while storing files. In other words, the storage
capacity of the disk is reduce.
Then DOS asks if you format another disk. You can enter Y, if you want to format another
disk. Otherwise, enter N to cancel the command.
If you format a floppy disk that contains files, it will remove all files from the disk. If you
format a disk containing useful file by mistake, try the UNFORMAT command immediately.
This command is discussed in the next section
OPTION with FORMAT
When you use the FORMAT command without any option, it formats the disk in the standard
capacity of the drive begin used for formatting. For instance, you use the command- FORMAT
A:, and drive A is a 1.2 MB DSHD floppy drive. Therefore, this command will format the disk
with 1.2-MB capacity. However, if you want a format a DSDD (360KB) floppy disk in a 1.2
MB floppy drive, you can use the option /4 with FORMAT, e.g. FORMAT A:/4.

Page 20

Introduction to MS-DOS

Normally, you format both sides of the floppy disk. However, if you wish a format only one
side on the disk, specify /1 after the drive latter with the format command, e.g. FORMAT
A:/1.
To format a disk in drive B, you can use FORMAT B: . If you like, FORMAT can
automatically copy DOS in the newly formatted disk. For that, use /S with FORMAT, e.g.
FORMAT B:/S. after the formatting of the disk in drive B is over, this disk becomes a bootable
disk. That is, you can use the disk start (boot) a PC. However, remember that disk does not
contain any external command file, such as FORMAT, DISKCOPY and XCOPY. You may
copy these files selectively from your DOS disk or directory by using the Copy command.
The FORMAT command can also be used to format a hard disk. If you try to format a hard
disk, DOS displays the following and similar massage:
WARNING, ALL DATA ON NON-REMOVABLE DISK
DRIVE C: WILL BE LOST!
Proceed with Format (Y/N) ?
This message warns you that if you proceed with formatting, all files & programs in all
directories on the hard disk (drive C) will be lost forever. You can enter N to cancel the
FORMAT command. If oyu are prepared to lose all data on the hard disk, you may press Y.
Unformatting a Diskette with UNFORMAT
Sometimes, after you have formatted a disk, you realise that you have make mistake. Now you
want to get back the files on the disk. In that case, you can use the UNFORMAT command.
The UNFORMAT command can help you to restore the file on the disk. For instance, if you
have used the command FORMAT A: to format the disk in drive A, you can use UNFORMAT
A: to restore back the file on the Disk.

Page 21

Introduction to MS-DOS

Most Commonly Used Internal and External DOS Commands

DOS Commands
DOS Commands are instructions to perform tasks on files and directories very useful
to Windows users. DOS commands are case insensitive. And as you already know, file
is the area where we store group of information or data, and collection of group of files
is called a directory.
In MS-DOS the file name follow 8dot3 format and is divided into two parts primary
name and secondary name. Primary name is up to 8 characters long and secondary
name is up to 4 characters with dot. For example, in the image file-name Logo.jpg,
Logo is the primary name and .JPG is the secondary name. Secondary names are fixed
for particular type of file, meaning for system files the secondary name is designated as
.sys, for text files it is .txt and so on. To name a file or directory special characters like
< > , . / * ? | & Space are not allowed. Here is the list of some of the important types of
files with their default secondary names:
Text file

.txt

Command file

.com

System file

.sys

Programme file

.prg

Database file

.dbm

Library file

.lib

Batch file

.bat

Executable file

.exe

DOS Commands are divided into 2 types:

1.

Internal Commands

Page 22

Introduction to MS-DOS
These are for performing basic operations on files and directories and
they do not need any external file support.

2.

External Commands
These external commands are for performing advanced tasks and they
do need some external file support as they are not stored
in COMMAND.COM

There are also Batch commands or Batch files which are text files that contain a list of
internal and/or external commands which are executed in sequence when the batch
file is executed. AUTOEXEC.BAT gets executed automatically onbooting.
In MS-DOS, keyboard shortcuts involving handy ones like Functional keys, arrows,
pipe character ( | ), asterisk (*), ?, [] and ESC are of great help for recalling to
searching to clearing command line etc., Here are few of them:

UP () and DOWN () arrows recall previously entered commands.

ESC clears the present command line. It abandons the currently


construct command and the next prompt appears.

F1 or retypes one character at a time from the last command entry


from the current cursor position.

F2 retypes all characters from the last command entry up to the one
identical to your next keystroke. It asks you to enter char to copy up to
and retypes the last command up to that char.

F3 retypes all remaining characters from the last command entry.

F4 stores all characters beginning at the first match with your next
keystroke and ending with the last command entry.

F5 or F8 keys give all the previously typed commands.

F6 places a special end-of-file code at the end of the currently open


file. Sometimes referred to as Ctrl+z or ^z.

F7 key displays command history and ALT+F7/ESC hides it.

F9 is used to select a command by number. Just enter the command


number and it fetches the command line for you.

Page 23

Introduction to MS-DOS

Pipe character ( | ) combines several series of commands or


programs inter-dependent.

Name enclosed within [] indicate a sub-directory.

Asterisk (*) is used to represent zero or more any characters.

? is used to present zero or single character.

MS-DOS commands perform tasks like:

Manage files and directories

Maintain Disks

Configure Hardware and Networking

Optimize the use of memory

Customize MS-DOS

Most Commonly Used Internal DOS


Commands
1.

DATE
This command is used to display the system current date setting and
prompt you to enter a new date. The syntax is: DATE [/T | date]

If you type DATE without parameters then it displays current date and
prompts to enter new date. We should give new date in mm-dd-yy
format. If you want to keep the same date just Press ENTER. DATE
command with /T switch tells the command to just output the current
system date, without prompting for a new date.

2.

TIME
This command is used to displays or set the system time.
The syntax is: TIME [/T | time]

Page 24

Introduction to MS-DOS

Same as DATE command, typing TIME with no parameters displays the


current time and a prompt for a new one. Press ENTER to keep the same
time. TIME command used with /T switch tells the command to just
output the current system time, without prompting for a new time.

3.

COPY CON
It is used to create a file in the existing directory. Here CON is a DOS
reserved word which stands for console.
Syntax is: COPY CON filename after that press Enter and start typing
your text and after youre done typing your text, to save and exit hit F6
key.

4.

TYPE
This command is used to display the contents of a text file or files. The
syntax is: TYPE

[drive:][path]filename

Now, lets try to display the contents of the file named filename weve
created earlier using COPY CON command.

5.

CLS
It is used to clear the screen. Syntax is CLS

Page 25

Introduction to MS-DOS

6.

REN
This command is used to change/modify the name of a file or files.
Syntax is: REN

[drive:] [path] filename1

filename2.

Here, filename1 is source file for which you wanted to change the name,
and filename2 will obviously becomes your new file name. Also note
that you cannot specify a new drive or path for your destination file.

7.

DIR
This command displays a list of files and subdirectories in a directory.
Syntax is: DIR

[drive:] [path] [filename]

[/A[[:]attributes]] [/B] [/C] [/D] [/L]


[/N] [/O[[:]sortorder]] [/P] [/Q]
[/S] [/T[[:]timefield]] [/W] [/X] [/4]
Here,
[drive:][path]
[filename]

Specifies drive, directory, and/or files to list.

/A:attributes

Displays files with specified attributes. The


possible attributes are as follow: D
Directories, R Read-only files, H Hidden
files, A Files ready for archiving, S System
files, Prefix meaning not

/B

display in bare format with no heading


information or summary

/C

Using this attribute with dir by default displays


the thousand separator in file sizes. To disable
display or separator use /-C

/D

Displays file list sorted by column.

/L

Uses lowercase in listing file names and sub-

Page 26

Introduction to MS-DOS
directories.
/N

Display in new long list format where filenames


are on the far right.

/O:sortorder

Displays list by files in sorted order. The


sortorder attributes are as follow: N By name
(alphabetic), S By size (smallest first), E By
extension (alphabetic), D By date/time
(oldest first), G Group directories first,
Prefix to reverse order

/P

Display page wise pausing after each screenful


of information and prompts to press any key to
continue.

/Q

Displays the owner of a file or files.

/S

Displays files in specified directory and all


subdirectories. Bear caution in using this in
your root directory as you may end up in
overflowing information. To stop the screen
overflow at any point hit Pause-Break key.

T:timefield

This sorts and displays the list based on time


field specified. C for Creation, A for Last Access,
W for Last Written

/W

Displays list width wise or wide list format.

/X

This is used to display the short names


generated for non-8dot3 file names.

Note that switches may be different in the DIRCMD environment


variable, in which case just override present switches by prefixing any
switch with (hyphen), for example instead of using /P use /-P

8.

PATH
This command displays the path that how we have come to the present
position or sets a search path for executable files.
Its Syntax is PATH [[drive:]path[;][;%PATH%]]

Page 27

Introduction to MS-DOS
Typing PATH without any parameters displays the current path under
current directory. Typing PATH ; clears all search-path settings and direct
cmd.exe to search only in the current directory. And including %PATH%
in the new path setting causes the old path to be appended to the new
setting.

9.

VER
This command displays the version of the Microsoft Windows running on
your computer.

10. VOL
It displays the disk volume label and serial number, if they exist for the
drive specified. If no drive is specified it displays for the active drive.
Syntax is VOL [drive:]

11. DEL/ERASE
Used to delete one or more files.
Syntax is DEL

[/P]

[/F]

[/S]

[/Q]

[/A[[:]attributes]] names

Here,
tr>

names

Specifies a list of one or more files or directories.


Wildcards * and ? may be used to delete multiple files. *
indicates group of unknown characters whereas using
wildcard ? in file-names is for single unknown character.
And using this command if a directory is specified, all
files within the directory will be deleted.

/P

Prompts for (Y)es/(N)o confirmation before deleting each

Page 28

Introduction to MS-DOS

file.
/F

Used to force delete read-only files.

/S

Delete specified files from all subdirectories. If


Command Extensions are enabled DEL and ERASE
change while using /S switch such that it shows you only
the files that are deleted, not the ones it could not find.

/Q

Delete in quite mode and do not ask if ok to delete on


global wildcard

Delete files based on specified attribute. The attributes


/
are: R for Read-only files, S for System files, H for
A:attribut Hidden files, A for files ready for archiving and Prefix
es
meaning not.

12. COPY
This command is useful in copying one or more files to another file or
location. Syntax is COPY
/B ]

source [/A | /B]

[/D]

[/V]

[/N]

[/Y | /-Y]

[+ source [/A | /B] [+ ]]

[/Z]

[/A |

[destination [/A

| /B]]
The different switches that can be used with this command as follow
along with their use.
source

It specifies the file or files to be copied.

/A

Indicates an ASCII text file.

/B

This switch indicates a binary file.

/D

This allows the destination file to be created with


decryption.

destinati This specifies the directory and/or filename for the new
on
file or files.
/V

Helps to verify new files to be written correctly.

/N

Specifying this switch uses short filename, if available,


when copying a file with a non-8dot3 file name.

Page 29

Introduction to MS-DOS

/Y

If destination file already exists, this switch suppresses


prompting to confirm you want to overwrite it and does it
asap.

/-Y

Contrary to above switch, this causes prompting to


confirm you want to overwrite an existing destination file.

/Z

Copies networked files in restartable mode.

For appending multiple files for source use wildcard or file1+file2+file3


format and make sure to specify a single file for destination.

13. MD, CD and RD


1.

MD (or MKDIR) command stand for make directory and it is

used to create a directory. Syntax is MD


2.

[drive:]path

CD (or CHDIR) stands for create or change directory and it allows


to display the name of or change the current directory or rather we
can say come out of a directory. Syntax is CD

[/D]

[drive:]

[path]

Typing CD drive: displays the current directory in the specified


drive. This CD (or CHDIR) command does not treat spaces as
delimiters due to which it allows to CD into a subdirectory name
that contains a space without surrounding the name with quotes.
For example:
CHDIR program filesmozilla firefox
is the same as:
CHDIR program filesmozilla firefox

If you type CD without any parameters it displays current drive


and directory. CD.. specifies that you want to change to the higher
directory in the current path. Whereas, using CD you can directly
change to parent/root directory from any location in the current
drive.

Using /D switch changes current drive in addition to current


directory for a drive.

Page 30

Introduction to MS-DOS

3.

RD (or RMDIR) command removes or deletes a directory.

There are two conditions to remove any directory (1) Directory to


be removed should be empty. and (2) We should be outside the
directory we are commanding to delete.
Syntax is RD

[/S]

[/Q]

[drive:]path

Here, using the switch /S removes a directory tree meaning it


removes all directories and files in the specified directory in
addition to the directory itself. And using /Q is the quiet mode that
doesnt asks for ok approval to remove a directory tree.

2.

PROMPT
This changes the cmd.exe command prompt. By default the prompt is
always set to the name of current drive followed by > sign.

Customize the Prompt


To customize the prompt to display any text of your choice, use the
syntax
prompt anytext and this will change the prompt to new command
prompt anytext.

Prompt with Options (or Special Codes)


You can use prompt with options. To let the prompt display the current
working directory use prompt $p$g
$p in the above signifies the current drive and path.
$g signifies the greater than sign >

Page 31

Introduction to MS-DOS

The other options used with prompt command are as follows.


Any combination of these can be used with prompt command.
$A & (Ampersand)
$B | (pipe character)
$C ( (Left parenthesis)
$D Current date
$E Escape code (ASCII code 27)
$F ) (Right parenthesis)
$H Backspace (erases previous character)
$L < (less-than sign) $N Current drive $Q = (equal sign) $T Current time
$V Windows XP version number $_ Carriage return and linefeed $$ $
(dollar sign)

Page 32

Introduction to MS-DOS

Most Commonly Used External DOS


Commands
1.

EDIT
This command is used to modify or change the data of a file.
Syntax is EDIT [/B] [/H] [/R] [/S] [filename(s)]
Using switch /B you can force the edit in monochrome mode. /H displays
the maximum number of lines possible for your system hardware.
Whereas using /R and /S one can load files in read-only mode and force
the use of short filenames respectively. [filename(s)] is used to specify
file(s) to go edit. You can use wildcards (* and ?) to specify multiple files.

2.

XCOPY
This command is used to copy files and directory trees from one disk to
another disk.
Syntax is XCOPY
[/P]

[/S [/E]]

[/R]

[/T]

source

[/V]

[/U] [/K]

[/W]

[destination]
[/C]

[/N] [/O]

[/I]
[/X]

[/Q]
[/Y]

[/Z] [/EXCLUDE:file1[+file2][+file3]]

3.

LABEL

Page 33

[/A | /M]
[/F]
[/-Y]

[/D[:date]]

[/L]

[/G]

[/H]

Introduction to MS-DOS
It is used to create, change, or delete the volume label of a disk.
Syntax is LABEL
LABEL [/MP]

[drive:] [label]

[volume]

[label]

Here, [drive:] is for secifying the drive letter of a drive to be labelled and
[label] specifies the label of the volume disk. [/MP] is used to specify
that the volume should be created as a mount point and [volume] is
used to specify volume name, usually mentioned after drive letter
followed by colon and then giving volume name required.

4.

DISKCOPY
This command copies the contents of one floppy from the source drive
to a formatted or un-formatted floppy disk in the destination drive. This
command copies the data from particular position on the source disk to
exactly the same position on the destination disk.
Syntax Diskcopy A: B:
copies contents of A: to B: drive. This command can be used with /V
switch which verifies that the disk is copied correctly.

5.

CHKDSK
This command is used to check a disk and display a status report with
properties of disk like serial number, volume label, memory and other
properties along with errors on the disk if any.
Syntax is CHKDSK
[/C]

[volume path]

[/F]

[/V]

[/R]

[/X]

[/I]

[/L[:size]]

[volume path] is where you specify the drive letter followed by a colon
and volume name to be checked. using /F switch allows you to fix errors
on the disk. /V display full path and/or cleanup message if any. /R is
used in tandem with /F and used to locate bad sectors and recover
readable information. If you wanted to perform a less vigorous check of
index entries on the disk then the right option is to use /I or /C rather
then /R as they skip checking of cycles on the volume and helps in
reducing the amount of time required to run chkdsk. Using /X forces the

Page 34

Introduction to MS-DOS
volume to dismount first before checking is performed. /L:size is all
about specifying the log file size in kilobytes.

6.

TREE
This command is very useful to view the list of directories and
subdirectories present on the disk in graphical form. If you wanted to
include files also with directories and subdirectories, then youll have to
give the command line as tree/f which presents the tree view of all the
content on your disk. Here is the syntax for this command with allowed
switches:
TREE

[drive:path] [/F] [/A]

In case you wanted use ASCII instead of extended characters, then go


ahead include /A in the command line.

7.

DELTREE
This command is used to remove a directory along with its contents.
Syntax is deltree [drive:path]
here, [drive:path] specifies the directory name to be deleted. All the
subdirectories and files in this directory will be deleted without prompt
and theres not getting back. So, keep caution while using this
command.

8.

DOSKEY
This command is generally used to edits command lines and recalls
commands.
Syntax is DOSKEY [/REINSTALL] [/HISTORY] [text]
Here, /REINSTALL installs new copy of doskey, /HISTORY is used to
display all previously given commands stored in memory. And [text]
specifies the commands you want to record.

9.

FIND

Page 35

Introduction to MS-DOS
This command searches for a specific text string in a file or files. Syntax
isFIND

[/V] [/C] [/N] [/I] [/OFF] string [[drive:]

[path]filename[ ]]
The basic essential elements in the command line for find are the
string enclosed in and [[drive:][path]filename(s)]. String specifies the
text string to find in the file and [[drive:][path]filename(s)] specifies the
file or files where the text string search is to be done. If a path is not
specified, FIND searches the text typed at the prompt or piped from
another command. When you append /OFF in the command line, it
searches and finds even those files with offline attribute set. Apart from
searching the text string, this command is useful in:
1.

Displaying all lines not containing the specified string @ /V


2.

Displaying only the number count of lines containing the text string
@ /C

3.

2.

Displaying line numbers with the displayed lines @ /N

SORT
This command is used to arrange the data of a file in alphabetical order
(A-Z, 0-9) or reverse alphabetical order.
Syntax is SORT

[/R]

[[drive1:][path1]filename1]

[/T [drive2:]

[path2]] [/O [drive3:][path3]filename3]


/R in command line reverses the sort order; that is, the data of the
specified file sorts sorts Z to A, then 9 to 0. [drive1:][path1]filename1
specifies the file to be sorted. /T [drive2:][path2] is used in cases of data
overflow in main memory and it specifies the path of the directory to
hold the sorts working storage. And /O [drive3:][path3]filename3
specifies the file where the sorted input is to be stored.

3.

FORMAT

Page 36

Introduction to MS-DOS
This command creates a new root directory and a File Allocation Table
(FAT) for the disk. In order for MS-DOS to be able to use a new disk you
must use this command to format the disk.

FORMAT with /S switch


When the disk is formatted with /s option, the disk can be used as a
booting disk. C:>DOS>Format A: /s
The above command copies the OS files MSDOS.SYS, IO.SYS and
COMMAND.COM which are required for booting the machine from your
system startup drive to the newly formatted disk. The disk can then be
used for booting.

FORMAT with /U switch


Heres the command C:DOS>Format A: /U
This command specifies an Unconditional Format which destroys all
existing data and prevents you from later unformatting the disk.

FORMAT with /Q switch


This can be used only with the previously formatted disk. This deletes
FAT, Root directory and data of disk but doesnt scan for the bad errors.
This is generally used for Quick formatting.
Warning As Format command deletes all existing data, use this
command with extreme caution. Any disk formatted (except with /U
switch) may be later unformatted using the UNFORMAT command.

4.

BACKUP
The Backup command backs up one or more files from one disk to
another. You can backup files onto either a hard disk or on a floppy disk.
Syntax is
BACKUP

Source

Destination

Here source specifies the location of files to be backed up and


destination drive specifies the drive on which you want to store the

Page 37

Introduction to MS-DOS
backup files. The backed-up files are stored in backup.nnn and
control.nnn files where nnn represents the backup disk number.

Backup with Switches


1.

The /S switch can be used to backup the contents of all files in


the source including the contents of sub-directories.

2.

The /N switch can be used to backup only those files that have
changed since the last backup.

3.

Backup command with /D:mm-dd-yyyy switch will backup files


that have changed since the data specified.

2.

RESTORE
The RESTORE command restores files that were backed up by using
BACKUP command. Syntax: RESTORE

drive1 drive2:path

Here drive1 specifies the drive on which backup files are stored.
drive2:path specifies the path to which those backup files will be
restored.
Using backup command with /S switch is used to restore all backup
files to their original directories and sub-directories.

Page 38

Das könnte Ihnen auch gefallen