1 FUN. OF.
COMP
NOTES
UNIT – III
DISK OPERATING SYSTEM (DOS)
OBJECTIVES
At the end of this lesson, you would be able to;
explain the concept operating system
discuss the functions of operating system
understand the procedures of loading operating system
into the memory
use file management features of operating system
create separate locations for logically related files
copy files from one computer to another
use Windows for File Management
3.1 INTRODUCTION
When the computer starts, it starts the operating system that
takes the control of the machine. An Operating System is a set
of programs that help in controlling and managing the
Hardware and the Software resources of a computer system. A
good operating system should have the following features;
1. Help in the loading of programs and data from external
sources into the internal memory before they are executed.
2. Help programs to perform input/output operations, such as;
o Print or display the result of a program on the
printer or the screen.
o Store the output data or programs written on the
computer in storage device.
2 FUN. OF. COMP
NOTES
o Communicate the message from the system to the
user through the VDU.
o Accept input from the user through the keyboard
or mouse.
3.2 DISK OPERATING SYSTEM
As the name suggests, the operating System is used for
operating the system or the computer. It is a set of computer
programs and also known as DOS (Disk Operating System). The
main functions of DOS are to manage disk files, allocate system
resources according to the requirement. DOS provides features
essential to control hardware devices such as Keyboard,
Screen, Disk Devices, Printers, Modems and programs.
Basically, DOS is the medium through which the user and
external devices attached to the system communicate with the
system. DOS translate the command issued by the user in the
format that is understandable by the computer and instruct
computer to work accordingly. It also translates the result and
any error message in the format for the user to understand.
(a) Loading of DOS
The BOOT Record into the computer memory loads DOS. BOOT
Record in turn is triggered by ROM program already there in
the computer.
The system start-up routine of ROM runs a reliability test called
Power On Self Test (POST) which initializes the chips and the
standard equipment attached to the PC, and check whether
peripherals connected to the computer are working or not.
Then it tests the RAM memory. Once this process is over, the
ROM bootstrap loader attempts to read the Boot record and if
successful, passes the control on to it. The
instructions/programs in the boot record then load the rest of
the program. After the ROM boot strap loader turns the
control over to boot record, the boot tries to load the DOS into
the memory by reading the two hidden files [Link] and
[Link]. If these two are found, they are loaded along
with the DOS command interpreter [Link].
[Link] contains routines that interpret what is typed
in through the keyboard in the DOS command mode. By
3 FUN. OF. COMP
NOTES
comparing the input with the list of command, it acts by
executing the required routines/commands or by searching for
the required routine utility and loads it into the memory.
3.3 COMPUTER FILES IN DOS
A file may contain a program or any other kind of information.
Generally, a file must be given a name that can be used to
identify it. DOS permits the user to assign a name consisting of
two parts to a file - primary and secondary names. Primary
name can be of a maximum of eight characters consisting of
Characters, Alphabets, Number and Hyphen), and the
Secondary name should consist of three characters, which is
optional. The primary name and the secondary (or extension)
name, if any, are to be separated by a dot (.).
Primary name can be linked to proper name, whereas
extensions are like surnames of people. Using an extension
with the file name is preferable, though optional. However,
once the extension is specified, using the complete name
(primary name and extension, with the period separating them
can only refer the file). Using extensions can be an excellent
way of naming a file so that it can be identified easily.
Examples:
Filename Primary Name Separator Secondary Name
Employee Employee
[Link] Employee . Exe
[Link] Employee . Dbf
DOS has a way of showing which disk drive is currently
active. The floppy disk drives are assigned alphabets A and B,
whereas the hard disk drive is assigned the alphabet C. If your
PC has a single floppy drive, the drive would be A and if it has
two, they would be termed as A and B. If your PC includes a
hard disk, besides a FDD (Floppy Disk Drive), the drive
names would be A and C. If the prompt is A, then it implies
that the first floppy disk drive is active. Where as the DOS
prompt would be C, if the hard disk is active. Data as well as
instructions reside in a file stored in a disk.
4 FUN. OF. COMP
NOTES
3.4 DIRECTORY STRUCTURE IN DOS
The files in the computer come from various sources. Some
files come with DOS, while other comes with publications such
as a word processor. These files contain codes and other
information that is necessary to make the computer application
operational. Before long, there will be hundreds or even
thousands of files in the computer, which can make it difficult
to locate specific files.
The names of all the files created in a disk are stored in its
directory. Directory is just like a file folder, which contain all
the logically related files. DOS files are organized in a
hierarchical or an inverted tree-like structure. The general
analogy is with a file cabinet containing a number of drawers,
which in turn may contain folders. The content of these folders
is the needed information.
The file cabinet here is the ROOT DIRECTORY, the drawer is
INDIVIDUAL DIRECTORY, the folders are SUBDIRECTORY
and the information in these folders may in turn be classified
as FILES.
Otherwise, the large number of files that get created for various
purposes in a disk can make the directory huge and difficult to
view and manage. Therefore, DOS enables the user to organize
the files in a disk into directories and sub-directories in a
hierarchical structure. Directories can contain other
directories. A directory within another directory is called a sub-
directory.
Of course, there may be sub-directories of sub-directories, but
a file name is the furthest you may descend down the (inverted)
tree of directories and files. Thus, a file name corresponds to a
tree leaf, a sub-directory to a branch, the directory to the trunk,
and the root directory to the root of the tree, hence the name
ROOT DIRECTORY.
5 FUN. OF. COMP
NOTES
Sample of Directory Structure
The directory/sub-directory is represented in bold letters.
3.4.1 DIRECTORY COMMAND
The content of each of the sub-directory cannot be viewed
unless it is made active, or a sub-directory is specified as part
of the DIR command. Doing either of these requires an
understanding of the concepts of navigating around the disk.
The directory, the user is in at any point of time, is called the
WORKING/PRESENT/CURRENT directory. DOS indicates
which directory you are in by displaying the directory's name in
the command prompt. For example, the following command
prompt indicate that you are in the DOS directory: C:\DOS>.
Knowing which directory is current helps you find files, and to
move from one directory to another more easily. Typically,
the ROOT DIRECTORY (\) is the initial working directory. The
entire specification of directory from root is called a PATH. By
itself, the DIR command is applicable to the working/present
directory. The names of the sub-directories at adjacent levels
are separated by backslash (\), while specifying the path to be
followed while traveling to a sub-directory.
3.4.2 DIR COMMAND
The DIR command gives the list of is there on the disk that is
mounted on the active drive.
Syntax : C:\> DIR A:\> DIR
6 FUN. OF. COMP
NOTES
Example
A:\> DIR
Volume in drive A has no label
Directory of A:\
COMMAND COM 23612 10-20-88 11.30a
DISKCOPY COM 4235 10-20-88 12.00p
FORMAT COM 15780 03-12-89 12.00p
3 files 325012 bytes free
A:\>
As can be seen, on typing DIR followed by <Enter> key at DOS
prompt, five columns of data followed by the number of files
and bytes that are free in the disk are displayed. The first
column contains the primary name of each file resident on the
disk. However, most files are named with an extension, which
appear in the second column. Whereas, the third column
contains the size of the file in bytes, and the fourth and fifth
columns show the date and time on which the files was created
or last modified. The last line displays the number of file(s)
and remaining disk space free in bytes. It is important to note
that the DIR command only displays the names of the files
and not their contents.
3.4.3 CHANGING A DIRECTORY
All the names displayed using DIR command that have <DIR>
besides them are directories. You can see the list of files in
another directory by changing to that directory and then using
the DIR command again.
The Change Directory (CHDIR) or CD command enables the
user to travel around the directories in a disk. Type the CD
command at the command prompt.
Syntax:
A:\> CHDIR {path} or a:\> CD {path}
7 FUN. OF. COMP
NOTES
Examples : (Refer to the figure)
# 1. A:\>CD \NOS
This command makes the NOS sub-directory under the root
directory (\) active.
# 2. A:\>CD \NOS\LETTERS
The backslash indicates the root, and LETTERS, which is a
sub-directory under the NOS directory, becomes the working
directory.
# 3. A:\> CD \
The root directory becomes the working directory; i.e. you will
change back to the root or main directory. The slash typed in
this command is a backslash (\). No matter which directory
you are in, this command always returns you to the root
directory of a drive. The root directory does not have a name,
it is simply referred to by a backslash (\).
3.4.5 MAKING OR CREATING DIRECTORY
As the number of files increases in a disk, a need is felt to
organize them in a meaningful way by creating sub-directories
to store a group of logically related/similar files.
To create a directory, DOS provides the MKDIR (Make
Directory) or MD command.
Syntax:
A:\>MKDIR [drive:] {pathname} or A:\>MD [drive:] {pathname}
Square brackets indicate that [drive:] entry is optional.
The MD or MKDIR command creates a new empty directory
whose name is the last item specified in the pathname, in the
specified drive. If active, the drive need not be specified. If the
directory is to be created as a sub-directory of the working
directory on the active drive, typing MD {directory name} at the
DOS prompt or command prompt is sufficient.
8 FUN. OF. COMP
NOTES
Examples:
# 1. A:\> MD \ACCT\SALARY
makes a SALARY directory in the: drive, under ACCT directory.
# 2. A:\> MD C:\> SALARY
Makes a salary directory in the C: drive, under root directory.
3.4.6 DELETING A DIRECTORY
You may want to delete or remove a directory to simplify your
directory structure. DOS provides RD (Remove Directory) to
delete a directory.
Example:
# 1. A:\> RD \ACCT\SALARY
removes the SALARY sub-directory in ACCT directory.
NOTE: You cannot delete a directory if you are in it. Before
you can delete a directory, you must type cd.. at the
command prompt. At the same point of time, the directory to
be deleted should be empty.
Management of directories Overview
See the chapter on the directories.
CD\ (Type CD + Alt 92) Return to the principal directory.
CD.. Return to the preceding directory.
CD WORD Open the directory WORD.
MD NAME Creation of the directory NAME.
RD NAME Delete of the directory NAME. With beforehand
one must open the file and erase all the files being in this
file (including under directories), then to return to the
root comprising this file.
9 FUN. OF. COMP
NOTES
DELTREE (MSDOS 6 and superior). Delete a directory
even if it contains files.
3.5 FILE MANAGEMENT
3.5.1 COPYING FILES
To copy a file, DOS provides `COPY' command. When you use
`copy' command, you must use the following two parameters;
the location and the name of the file you want to copy, or
the source; and the location and the file name to which you
want to copy the file or the target (destination). You separate
the source and the destination or target with a space. The
syntax of the `COPY' command is
COPY {source} {destination} or,
COPY [drive:] [path] [filename] [drive:] [path] [filename]
i.e. the first set of drive, path and filename refers to the
source file, and the second set of drive, path and filename
refers to the destination file.
(a) Copying Single File
To copy the [Link] file from the DOS directory to the
NOS
directory
1. Return to the root directory by typing the following command
prompt: CD\
2. Change to the DOS directory by typing the following
commands at the DOS prompt: CD DOS
3. To copy the file [Link] file from the DOS directory to
the
NOS, directory type the following at the command prompt:
Copy c:\dos\[Link] c:\nos and the following message
appears: 1 file (s) copied
10 FUN. OF. COMP
NOTES
Examples:
# 1. A:\> copy a:\letter\[Link] \letter\[Link]
makes a copy of the [Link] file in the current or working
directory with a new name [Link]
# 2. A:\> copy [Link] a:\letters\[Link]
copy the file [Link] from the root directory to the sub-
directory LETTER under root directory with a new name
[Link].
If the target drive is not specified, the copied file will reside in
the disk mounted on the active drive.
3.5.2 RENAMING FILES
To rename a file, DOS provides REN command. The REN
command stands for "Rename". When you use the REN
command, you must include two parameters. The first is the
file you want to rename, and the second is the new name for
the file. You separate the two names with a space. The REN
command follows this pattern:
REN oldname newname
Example: REN [Link] [Link]
Rename the old filename [Link] to a new filename
[Link].
3.5.3 DELETING FILES
This section explains how to delete or remove a file that is no
longer required in the disk. DOS provides DEL command,
which means to delete.
Syntax : DEL {drive:} {path} {filename}
Example:
# 1. DEL \DOS\[Link]
11 FUN. OF. COMP
NOTES
delete the [Link] from the DOS directory under ROOT
directory.
3.5.4 PRINTING A FILE
The `PRINT' command of DOS works more or less like `TYPE'
com
mand, but at the same time, it enables the content of a text file
to be printed on a paper.
Syntax:
A:\> PRINT [drive:] {path} {filename}
Example:
A:\> PRINT \AIAET\LETTER\[Link]
3.5.5Selection of one or more files
All the commands followed by a space then various following
syntaxes, will act on the selected files:
[Link] Selection of a file which one specifies the
NAME and EXTension.
*.EXT Selection of all the files which one specifies
EXTension.
B*.* Selection of all the files whose name starts with B.
C*.EXT Selection of all the files whose name starts with C
and which one specifies EXTension.
*.* Selection of all the files without exception.
12 FUN. OF. COMP
NOTES
3.5.6 Attributes of files
The four attributes which interest us here are: Reading alone,
files, hidden, and system. We will see the three first.
Syntax:
ATTRIB [Link] +r Activates the reading alone with the
file [Link]. One cannot erase any more this file with the
command erase.
ATTRIB [Link] -r Desactive reading alone with the file
[Link].
ATTRIB [Link] Display the attributes of the file [Link].
ATTRIB *.* Display attributes of all the files.
ATTRIB *.* +r /s Put all input files alone including the
files located in under directories (parameter /s).
Parameters: Reading alone +r or -r, files +a or -a, hidden +h or -
h, and system +s or -s.
The attribute "reading alone" makes it possible to avoid erasing
by error such or such file by the command erase. It's necessary
to give this attribute to -r to inhibit it.
The hidden attribute (ATTRIB [Link] +h for activated this
attribute on the file [Link]) makes it possible the file not to be
displayed at the time of a listing of files (command DIR).
The attribute file indicate if the file were modified since its last
backup. This attribute is useful for command XCOPY seen
further.
The attribute system indicate to the operating system if such or
such file is a file forming part of those used by the operating
system. In practice we do not have to serve to us directly as this
attribute nor of the files reserved by MS-DOS.
13 FUN. OF. COMP
NOTES
3.5.7 Catalogue (listing of the file names stored on mass
memory)
DIR Catalogues of the current drive.
DIR A: Catalogue of reader A (idem for B and C).
DIR *.COM Catalogues of all the files whose extension is
COM.
DIR X:*.* Catalogue of all the files whose name starts
with X.
In this case one obtains the list of all the files with their co-
ordinates, cuts, date and hour of the last backup of the files.
There are two options which make it possible to differently
present the list of these files (/P and /W).
Options of DIR
DIR /S Displays also the contents of under
directory.
DIR /W Displays only the name of the files on five
columns.
DIR /P If the number of files is not due to the
screen, /P mark a pause before displaying the
continuation.
DIR /B Gives only the name of the files without
their co-ordinates (size and date).
One can of course combine these options. Example:
DIR *.DOC /S /P Display the files whose extension
is DOC while including there under directories and
by marking a pause in the run of the list of the
files.
14 FUN. OF. COMP
NOTES
3.5.8 Visualization of the contents of a textual file
TYPE [Link] Sending with the screen contents of the
file [Link]. This file being with the format text such as
the batch where txt.
MORE < [Link] Idem that previously but with the
difference that visualization marks a pause before
displaying the continuation of the text if the file does not
hold on a screen.
3.5.9 Printing
After the commands DIR and STANDARD, if command PRN > is
specified, that will send to the printer the list files (DIR) or the
contents of a file (STANDARD):
DIR > PRN. Printing of all the list of the files.
DIR * DOC > PRN. Printing of all the list of the files whose
extension is DOC.
TYPE [Link] > PRN. Printing of the contents of a file
which one specifies the NAME and EXTension.
3.5.10 Virtual drive
We can attribute a letter at a directory for that it to be seen as a
drive.
Example, instead of to do dir c:\toto, we can do dir e:.
Dir e: list the files of c:\toto.
The instruction is subst. Syntaxe : subst drive directory.
Options
subst e: toto, attribute the letter e at the directory toto.
subst, list the letters associated at the directory.
subst e: /d, delete the relation between the letter and the
directory.
15 FUN. OF. COMP
NOTES
Warning
When we attribute the letter at the directory, we must to put
the whole directory. Example : subst e: c:\toto.
We can use subst e: toto, but if at this moment we are in the
directory c:\document, the drive e: will are attributed at
c:\document\toto and not at c:\toto.
For the example, after to have did subst e: toto when you are in
the directory c:\document, at the next copy a:*.* e:, the files will
are copied in c:\document\toto and not in the directory c:\toto.
It's the reason why you must to put the whole directory (subst
e: c:\toto) for to be certain that the new drive select the good
directory (c:\toto in our example).
We can put the subst in the [Link] if we wish a
automatical relation for the letter at the directory when the
computer start.
3.5.11 Others
CLS Erasure of the screen.
3.5.12 The batch
The batch are files which allow the processing in batch of
commands MSDOS. If there is a succession of commands
which one must regularly carry out, one places these
commands in a file called batch. One can thus put at it all the
commands of the cls type, cd... ; but certain instructions (which
we will see) are specific to the batch.
These files batch have the extension "bat" and are with the
format text, therefore being able to be to create with any text
editor recognizing the ASCII.
Instruction echo
This instruction is used for two things, to display text with the
screen and to require to display or not the continuation of the
instructions to be carried out.
The sign arrobas (@) makes it possible not to display the
instruction in the course of execution. Example : the
16 FUN. OF. COMP
NOTES
instruction "@copy toto titi" copies the file toto in a file titi but
without displaying the instruction "copy toto titi".
To avoid having to put the arrobas at all the instructions, we
can put @echo off. The instruction is execute but not to display.
The instruction "@echo on" restore the display.
The instruction "@echo." print a empty line.
The instruction "@echo toto" print the text toto.
Example :
@echo off
cls
echo Hello
echo.
echo toto
Result :
Hello
toto
Instruction exist
Example 1 :
if exist toto echo The file toto exist.
if not exist toto echo The file toto don't exist.
The first line (if exist) test if the file exist.
The second line (if not exist) test if the file don't exist.
In the two case, the test if print the good message.
Example 2 :
if not exist rep md rep.
If the folder don't rep exist, then rep is created.
Example 3 :
if exist toto goto next
rem Put here the instruction at to do if the file (or the
directory) toto don't exist.
:next
17 FUN. OF. COMP
NOTES
Here, we go at next if the file toto exist, else the instruction
following the test if is did.
This examples test if a file exist. For to test if a folder exist, we
must put the parameter \nul after the name of folder. Example
for to test if the folder toto exist :
if exist toto\nul goto suite
echo toto don't exist
goto fin
:suite
echo toto exist
:fin
Command choice
The command choice ask à the user to push a letter among the
letter proposed. The letter selected is tested by the command
errorlevel.
Option :
/C[:]keys: Specify the keys at to propose. It's YN (Yes or
No) if the keys aren't specified.
/N : Don't print the keys and the ?.
/S : The difference between the capital and the small
letter are did.
/T[:]c,nn : The key "c" is choice if the use don't push a
key after nn second.
Example ([Link]) :
@echo off
:menu
cls
echo d) execute defrag
echo s) execute scandisk
echo q) quit
choice /c:sdq What do you want
if errorlevel = 3 goto fin
if errorlevel = 2 goto def
if errorlevel = 1 goto scan
:def
defrag
18 FUN. OF. COMP
NOTES
goto menu
:scan
scandisk
goto menu
:fin
This batch is execute until we push the key q. Else it's the soft
defrag when we push d and scandisk when it's s.
Parameters
The directive %1 (sign percent and a number from 1 at 9) give
the nine parameters that the batch accept.
Example : If the batch [Link] have the command "echo %1", if we
type "x toto" then the word toto will are printed.
Example with the test if :
if "%1"=="toto" goto xxx
goto end
:xxx
echo You have taped toto.
:end
Warning, the test if do the difference between the capital and
the small letter. In our example, if we type Toto, the message
(You have taped toto.) isn't printed.
Command shift
This command shift the parameters. The first parameter take
the value of the second, the second take the value of the third,
until the last (the ninth). After the last is empty.
Example of application :
We want copy all the files with the extension that the user
want.
Batch :
:again
if "%1"=="" goto finish
19 FUN. OF. COMP
NOTES
copy *.%1 a:
shift
goto again
:finish
Example : batch txt doc.
Remark :
The instruction if test if the first parameter is empty. In
this case we go the end of the batch.
Else the batch copy the file with the extension given by
the first parameter (%1), shift the parameter and to go at
again for the next extension.
With this instruction if, the batch copy the files until the first
parameter are empty.
Others
In the batch, we can put all the commmand msdos (attrib,
copy, dir...)
3.6 USE OF WILDCARD CHARACTERS
If you want to carry out a task for a group of files whose names
have something in common, you can use wildcard characters
to specify groups of files. DOS recognize two wildcard
characters: asterisk (*) represents one or more characters that
a group of files has in common; and the question mark (?)
represents a single character that a group of files has in
common. You can use wildcards to replace all or part of a file's
name or its extension. The following table shows examples of
wildcards:
Wildcard What it Represents Example
[Link]
*.TXT All files with a .TXT extension
[Link]
All files named REPORT with any [Link]
REPORT.*
extension [Link]
20 FUN. OF. COMP
NOTES
[Link]
M
All files beginning with letter
M*.* [Link]
regardless of their extension
[Link]
All files having 3 letter names, [Link]
???.*
with any or no extension [Link]
You can include the wildcard in the command.
Use of wildcard characters in COPY command
# 1. A:\>COPY \letters\*.COB B:
It means, copy all files with extension *.COB from the directory
LETTERS under the ROOT directory to the working or ROOT
directory of the `B' drive.
# 2. A:\> COPY B:\COMPANY\OPEL.*
The command is to copy all files with primary name OPEL
(irrespective extension) in the directory COMPANY under
ROOT of the drive `B' into the current working directory of the
disk mounted in `A' drive. Incase of one drive, the system will
ask for the source and
target drive.
The command,
#3.A:\>COPY C:\*.*
copies all files of the ROOT directory of the 'C' drive into the
working directory of the 'A' drive.
# 4. A:\> COPY LETTE?.* B:
copies all files with primary name consisting of 6 characters in
total and LETTE as the first five characters (irrespective of
extension name) into drive `B'.
21 FUN. OF. COMP
NOTES
# 5. A:\> COPY B:\?.DOC
copies all files having a primary name of one character with an
extension .DOC from ROOT directory of 'B' to the ROOT
directory of `A' drive.
3.7 DOS VERSIONS
Year Event
1981 MS-DOS 1.0 was released August, 1981.
1982 MS-DOS 1.25 was released August, 1982.
1983 MS-DOS 2.0 was released March, 1983.
1984 Microsoft introduces MS-DOS 3.0 for the IBM PC AT and
MS-DOS 3.1 for networks.
1986 MS-DOS 3.2 was released April, 1986.
1987 MS-DOS 3.3 was released April, 1987.
1988 MS-DOS 4.0 was released July, 1988.
1988 MS-DOS 4.01 was released November, 1988.
1991 MS-DOS 5.0 was released June, 1991.
1993 MS-DOS 6.0 was released August, 1993.
1993 MS-DOS 6.2 was released November, 1993
1994 MS-DOS 6.21 was released March, 1994
1994 MS-DOS 6.22 was released April, 1994
3.8 USING PATH TO SPECIFY THE LOCATION OF FILES
A path is the route that leads from the root directory of a
drive to the file you want to use.
For example, to access the [Link] file in the LETTER
subdirectory of NOS directory, DOS must go from the ROOT (\)
directory through the NOS directory to the LETTER directory,
as shown in the following figure:
22 FUN. OF. COMP
NOTES
To specify the same path at the command prompt, you would
type it as shown in the following illustration:
C:\NOS\LETTER\[Link]
This is the path or route to the file [Link]. The first letter and
the colon (C:) represent the drive the file is on. The first back
slash (\) represents the root directory. The second backslash
separates the NOS directory from the LETTER sub-directory.
The third backslash separates the LETTER sub-directories
from the file name, [Link].
Note: MS-DOS recognizes path up to 67 characters long
(including the Drive letter, colon, and backslash).
3.9 DOS COMMAND SET
MS-DOS secret and/or unknown commands
Below is a listing of MS-DOS commands that are not listed in
any available help manual or in the commands syntax or are
commonly unknown commands. Many of these commands that
are known can be very useful when using MS-DOS, while some
of the other commands are unknown and/or appear to do
nothing.
23 FUN. OF. COMP
NOTES
Please use these commands cautiously, some of the
commands can erase data and/or erase data without
warning.
ATTRIB , The command is short for ATTRIB -a -h -r -
s *.* (removes all attributes of a file).
BACKUP /HP Unknown
DIR , This lists all files including hidden files,
does not work in Windows 95 / 98 / NT /
2000.
DIR ... Lists all directories that do not have
extensions. In Windows 95 / Windows 98
will list the contents of the directories
previous to the directory currently in.
DOSKEY Utilize doskey functions in MS-DOS
/APPEDIT command utilities such as edlin and
debug.
DOSKEY Unknown
/COMMAND
DOSKEY Unknown
/PERMANENT
DOSKEY Unknown
/SCRSIZE
DOSKEY Unknown
/XHISTORY
FDISK /MBR Recreates the Master Boot Record See
CH000175 for additional information.
FDISK /PRI See FDISK Page for additional information.
FDISK /EXT See FDISK Page for additional information.
FDISK /LOG See FDISK Page for additional information.
FDISK /Q Prevents fdisk from booting the system
automatically after exiting fdisk.
FDISK /STATUS Shows you the current status of your hard
drives.
24 FUN. OF. COMP
NOTES
FORMAT Formats the hard drive without any
/AUTOTEST prompting.
FORMAT Like /AUTOTEST but it will ask you for a
/BACKUP volume label.
FORMAT /Z:n Command used with FDISK supporting
FAT32, used to specify the cluster size in
bytes where n is multiplied by 512.
MEM /A or Adds a line into the MEM command tells
/ALL the available space in HMA.
RESTORE /Y Unknown
RESTORE /Z Unknown
SET DIRCMD=0 Will make all directories hidden however
still accessible, to get them back SET
DIRCMD=
SHARE /NC Unknown
TRUENAME When placed before a file, will display the
whole directory in which it exists.
VER /R Tells you the Revision and if DOS is in
HMA.
3.9.1 INTERNAL COMMANDS
assoc
The assoc command displays the file association for each of the
different file extensions on the computer.
Additional information and help with computer file extensions
can also be found on our file extensions page.
atmadm
Lists connections and addresses seen by Windows ATM call
manager.
call
Enables a user to execute a batch file from within another
batch file.
cd
CD (Change Directory) is a command used to switch directories
in MS-DOS. For example, if you needed to run Windows 3.11
from DOS, you would type:
25 FUN. OF. COMP
NOTES
cd windows - Changing the directory to Windows;
win - To run the [Link] file within the windows directory.
chdir
Chdir (Change Directory) is a command used to switch
directories in MS-DOS.
cls
Cls is a command that allows a user to clear the complete
contents of the screen and leave only a prompt.
color
The color command enables users running Microsoft Windows
2000 and Windows XP to quickly and easily change the default
color of their background and/or text in their MS-DOS window.
copy
Allows the user to copy one or more files to an alternate
location
date
The date command can be used to look at the current date of
the computer as well as change the date to an alternate date.
echo
Echo is used to repeat the text typed in back to the screen
and/or can be used to echo to a peripheral on the computer,
such as a COM port.
exit
The exit command is used to withdrawal from the currently
running application and/or the MS-DOS session.
goto
Moves a batch file to a specific label or location, enabling a user
to rerun a batch file or skip other lines depending on user
inputs or events.
for
The FOR variable is used for batch files to run a specified
command when a parameter is met or specified.
md
Allows you to create your own directories in MS-DOS.
move
Allows you to move files or directories from one folder to
another, or from one drive to another.
prompt
Allows you to change the MS-DOS prompt to display more or
less information.
rd / rmdir
Removes empty directories in MS-DOS. To delete directories
with files or directories within them the user must use the
26 FUN. OF. COMP
NOTES
deltree command, or if you are running Microsoft Windows
2000 or Windows XP use the /S option.
ren and rename
Used to rename files and directories from the original name to a
new name.
In earlier releases of MS-DOS instead of using ren or rename
you need to use the move command to rename your MS-DOS
directories or files.
setlocal
Enables local environments to be changed without affecting
anything else.
switches
Loaded in the [Link] switches allows you to add and remove
various functions of MS-DOS.
set
Allows you to change one variable or string to another.
lock / unlick
Lock allows a user to lock a drive, enabling direct disk access
for an application.
Unlock allows a users to unlock a drive, disabling direct disk
access for an application
ver
Displays the version of MS-DOS or if running Windows 95 or
above the version of Windows.
Information about Windows versions can be found on our
Windows version page.
verify
Enables or disables the feature to determine if files have been
written properly.
vol
Displays the volume information about the designated drive.
3.9.2 EXTERNAL COMMANDS
[Link]
Defines functions that change display graphics, control cursor
movement and reassign keys. The [Link] device driver
supports ANSI terminal emulation of escape sequences to
control your system's screen and keyboard. An ANSI escape
sequence is a sequence of ASCII characters, the first two are
the escape character (1Bh) and the left-bracket character (5Bh).
The character or characters following the escape and left-
bracket characters specify an alphanumeric code that controls
27 FUN. OF. COMP
NOTES
a keyboard or display function. ANSI escape sequences
distinguish between uppercase and lowercase letters; for
example, "A" and "a" have completely different meanings.
append
Similar to the PATH MS-DOS command, the append command
enables a user to open files in the specified directory as if they
were in the current directory.
arp
Displays, adds and removes Arp information from network
devices.
assign
Introduced with MS-DOS 2.0 and has been available up to 6.0
where it was removed because of concern with data issues. Was
latter made available on the MS-DOS 6.0, 6.2 and 6.22
supplemental disks. The assign command redirects disk
operation on one drive to a different drive.
Any users using Windows 95 or above should not use this
command and consider using the SUBST command as a
substitute.
assoc
The assoc command displays the file association for each of the
different file extensions on the computer.
Additional information and help with computer file extensions
can also be found on our file extensions page.
at
Enables users to schedule tasks to be performed at a specified
time and date.
attrib
Attrib allows a user to change the properties of a specified file.
Using attrib, the user has the capability of changing the file to
have any of the below attributes. Note if you're wanting to
change the ACL's of a file see the CACLS command.
Read-only - allowing the file to be only viewed and not written
to.
Archived - allowing Microsoft backup and other backup
programs to know what files to backup.
Hidden - making the file invisible to standard users.
System - making the file an important system file.
backup
MS-DOS application that enables users to backup their data on
their computer.
MS-DOS 6.0, 6.2, 6.21, and 6.22 users use the msbackup
command. However, this file is still available to these users on
the MS-DOS 6.0 and 6.22 supplemental disk.
28 FUN. OF. COMP
NOTES
batch
The batch command is a recovery console command that
executes a series of commands within a file.
If you are looking for additional information about batch files
we suggest you look at our batch file page.
cacls
The cacls command enables a user to view and modify the ACLs
of a file. If you're wanting to change the read/write, hidden,
system settings of the file see the attrib command.
chcp
Before the chcp command can be used, the nlsfunc must be
loaded, as well as the [Link] must be loaded into the
[Link].
The chcp command is used to supplement the International
keyboard and character set information, allowing MS-DOS to be
used in other countries and with different languages.
chkdsk
Chkdsk is a utility that checks the computer's hard disk drives'
status for any cross-linked or any additional errors with the
hard disk drive.
MS-DOS versions 2.x - 4.x used [Link],
MS-DOS versions 5.x and beyond used [Link].
chkntfs
The chkntfs command is used to display or modify the checking
of the disk drive using NTFS at boot time.
choice
Allows for batch files and scripts to wait for the user to choose a
set of choices.
Microsoft Windows 2000 and Windows XP users who have
batch files that utilize the choice command should modify the
batch file to use the MS-DOS set command.
cipher
Displays or alters the encryption of directories [files] on NTFS
partitions.
command
The [Link] is the command interpreter for MS-DOS and
is required for the majority of Microsoft's operating systems.
Without [Link] the computer running a Microsoft
operating system would be unable to boot.
When running Windows NT, 2000, XP, or future operating
systems there are two versions of the command interpreter,
[Link] and [Link]. Cmd offers additional environment
variables than [Link]; however, it is recommend if you
are attempting to run a MS-DOS utility that you utilize the
29 FUN. OF. COMP
NOTES
[Link]. To use [Link], click Start / Run and
type command.
Information about creating a bootable diskette, which
also requires [Link], can be found on our boot
diskette page.
Additional information about shells can be found on our
shell dictionary definition.
Additional information about COMMAND vs. CMD can be
found on document CH000395.
convert
Converts FAT volumes to NTFS.
control
Control enables Microsoft Windows users to open the Control
Panel and items within the Control Panel from the command
prompt.
Defrag
Microsoft Defrag was first introduced with MS-DOS 6.0 and is a
software utility capable of organizing the files on the hard disk
drive.
compact
Compact is a MS-DOS command used to compress,
uncompress, and view compressed files.
diskcopy
The diskcopy utility allows a user to copy the complete contents
of a diskette to another diskette.
It is not recommended that the diskcopy command be used for
anything but a floppy diskette
edit
Edit allows a user to view, create, and/or modify their computer
files.
If you are unable to get this program to work, try typing in
"path c:\windows\command" if you have Windows95/98, or
type in "path c:\dos" if you have Dos 5.x/6.x/7.x or Windows
3.x and try again. If you still are not able to get edit to work, it
may not be on the hard drive; type in dir [Link] /s at the
c:\>. If it says that the file is not found, you may not have this
feature.
If you are running a MS-DOS version 4.x or lower or you are
unable to find [Link] on your hard disk drive, you can also
use the below command to create a file.
copy con <name of file>
Once you have entered the above command this will create the
file with the name specified. Once you have typed all the lines
you wish to be in the file, press and hold CTRL + Z. This should
30 FUN. OF. COMP
NOTES
enter ^Z, once on the screen, press enter and one file should be
copied.
extract
The Windows extract command is used to take files that are
compressed in a Windows Cabinet file and place it into a
specified location on the hard disk drive.
An additional definition and related terms for "extract" can be
found on our extract definition page.
format
Format is used to erase all of the information off of a computer
diskette or fixed drive.
find
Allows you to search for text within a file. Although MS-DOS
itself is not case sensitive, when typing in the string that you
are looking for with the find command, it is case sensitive.
Additionally, this command is used to find text within a file, not
the actual file itself. If you are wanting to search or find a file
with a particular name, use the dir command.
Users who are running Microsoft Windows 2000 or Windows XP
should also consider using the improved findstr command.
enable
The enable command is a recovery console command to enable
a disabled service or driver.
fasthelp
Command that provides instant access to all of the MS-DOS
commands, giving you a brief on each command; may not work
in some versions of MS-DOS.
gpupdate
Refreshes the local computers policy and any Active Directory-
based Group policies.
help
Help is used to access the information and help file from a MS-
DOS prompt.
MS-DOS 5.x uses [Link].
MS-DOS 6.x uses [Link].
Microsoft Windows 2000 uses [Link]
Microsoft Windows XP uses [Link]
For quick reference help with MS-DOS commands in any of the
versions of MS-DOS or Windows, you can also use the -help or
/? after a command; for example:
dir -help
or
dir /?
31 FUN. OF. COMP
NOTES
if command
Syntax
Windows 95, Windows 98, and Windows ME syntax
Performs conditional processing in batch programs.
IF [NOT] ERRORLEVEL number command
IF [NOT] string1==string2 command
IF [NOT] EXIST filename command
NOT Specifies that Windows should carry out
the command only if the condition is false.
ERRORLEVEL Specifies a true condition if the last
number program run returned an exit code equal to
or greater than the number specified.
command Specifies the command to carry out if the
condition is met.
string1==string2 Specifies a true condition if the specified
text strings match.
EXIST filename Specifies a true condition if the specified
filename exists.
Windows 2000 and Windows XP syntax
Performs conditional processing in batch programs.
IF [NOT] ERRORLEVEL number command
IF [NOT] string1==string2 command
IF [NOT] EXIST filename command
NOT Specifies that Windows 2000 / XP should
carry out the command only if the condition
is false.
ERRORLEVEL Specifies a true condition if the last program
number run returned an exit code equal to or greater
than the number specified.
string1==string2 Specifies a true condition if the specified text
strings match.
EXIST filename Specifies a true condition if the specified
filename exists.
command Specifies the command to carry out if the
condition is met. Command can be followed
32 FUN. OF. COMP
NOTES
by ELSE command that will execute the
command after the ELSE keyword if the
specified condition is FALSE
The ELSE clause must occur on the same line as the command
after the IF. For
example:
IF EXIST filename. (
del filename.
) ELSE (
echo filename. missing.
)
The below example would NOT work because the del command
needs to be terminated by a newline:
IF EXIST filename. del filename. ELSE echo filename. missing
Nor would the below example work, since the ELSE command
must be on the same line as the end of the IF command:
IF EXIST filename. del filename.
ELSE echo filename. missing
The below example would work if you want it all on one line:
IF EXIST filename. (del filename.) ELSE echo filename. missing
If Command Extensions are enabled IF changes as follows:
IF [/I] string1 compare-op string2 command
IF CMDEXTVERSION number command
IF DEFINED variable command
where compare-op may be one of:
EQU - equal
NEQ - not equal
LSS - less than
LEQ - less than or equal
GTR - greater than
GEQ - greater than or equal
33 FUN. OF. COMP
NOTES
and the /I switch, if specified, says to do case insensitive string
compares. The /I switch can also be used on the
string1==string2 form of IF. These comparisons are generic, in
that if both string1 and string2 are both comprised of all
numeric digits, then the strings are converted to numbers and
a numeric comparison is performed.
The CMDEXTVERSION conditional works just like
ERRORLEVEL, except it is comparing against an internal
version number associated with the Command Extensions. The
first version is 1. It will be incremented by one when significant
enhancements are added to the Command Extensions.
CMDEXTVERSION conditional is never true when Command
Extensions are disabled.
The DEFINED conditional works just like EXISTS except it
takes an environment variable name and returns true if the
environment variable is defined.
%ERRORLEVEL% will expand into a string representation of
the current value of ERRORLEVEL, provided that there is not
already an environment variable with the name ERRORLEVEL,
in which case you will get its value instead. After running a
program, the below example illustrates ERRORLEVEL use:
goto answer%ERRORLEVEL%
:answer0
echo Program had return code 0
:answer1
echo Program had return code 1
You can also using the numerical comparisons above:
IF %ERRORLEVEL% LEQ 1 goto okay
%CMDCMDLINE% will expand into the original command line
passed to [Link] prior to any processing by [Link],
provided that there is not already an environment variable with
the name CMDCMDLINE, in which case you will get its value
instead.
%CMDEXTVERSION% will expand into the a string
representation of the current value of CMDEXTVERSION,
provided that there is not already an environment variable with
34 FUN. OF. COMP
NOTES
the name CMDEXTVERSION, in which case you will get its
value instead.
ipconfig
Ipconfig is a DOS utility that can be used from MS-DOS and a
MS-DOS shell to display the network settings currently
assigned and given by a network. This command can be utilized
to verify a network connection as well as to verify your network
settings.
logon
The logon command is a recovery console command that lists
the installations of Windows 2000 / Windows XP and requests
the local administrator password for those installations.
logoff
The logoff command is an external command that allows a user
to quickly logoff their computer from the command line or
within a batch file.
loadfix
Loads a program above the first 64K of memory, and runs the
program.
mode
Mode status is used to view and/or modify a port or display
setting.
more
More allows information to be displayed one page at a time.
msbackup
A later MS-DOS application that enables users to backup their
data on their computer.
The msbackup is a MS-DOS version of the new backup
command and mwbackup is the Windows version of this
backup program.
MS-DOS 6.0, 6.2, 6.21, and 6.22 users can still find the older
backup file on the MS-DOS 6.0 and 6.22 supplemental disk.
nbtstat
MS-DOS utility that displays protocol statistics and current
TCP/IP connections using NBT.
netsh
MS-DOS command that enables users to change network
settings such as changing their network device from a dynamic
address to a static address or changing the IP address.
nslookup
MS-DOS utility that enables a user to look up an IP address of
a domain or host on a network.
Users who are using earlier versions of Microsoft Windows 95,
Windows 98, or Windows ME and need the options available
35 FUN. OF. COMP
NOTES
with the nslookup command will need to download an
alternative, third-party program.
path
Path is used to specify the location where MS-DOS looks when
using a command. For example, when using the command
"format", if the path is not specified to where the command is
you will receive bad command or file name.
pathping
Similar to the tracert command, pathping provides users with
the ability of locating spots that have network latency and
network loss.
ping
Helps in determining TCP/IP Networks IP address as well as
determine issues with the network and assists in resolving
them.
power
Allows you to conserve power with computer portables.
qbasic
QBasic is a variant of the BASIC programming language
designed by Microsoft. With QBasic the user can design
computer programs and/or utilities.
reg
Command line registry tool that enables you to change, display,
update, and otherwise manipulate the registry from the prompt.
shutdown
Enables a user to shutdown a Windows XP computer from the
command line as well as perform additional features that are
not available through Windows.
sys
Sys is used to copy the system files from one drive to another
drive, allowing that drive to be bootable.
When running sys, the below files will be copied.
[Link]
[Link]
[Link]
[Link]
SETVER
For setver to work, [Link] device must be loaded in the
[Link].
Setver is used to imitate the version of DOS in case an
application was unable to run because of a newer version of
MS-DOS.
36 FUN. OF. COMP
NOTES
sort
Sorts the input and displays the output to the screen.
scandisk
Microsoft Scandisk was first introduced with MS-DOS 6.2 and
is a software utility capable of checking the hard disk drive
and/or floppy diskette drive for any disk errors.
share
Installs support for file sharing and locking capabilities.
taskkill
Allows a user running Microsoft Windows XP professional or
Windows 2003 to kill a task from a MS-DOS prompt.
Note: Users running Windows XP home edition do not have
access to this command. You will need to use the command
tskill.
telnet
Enables a user to telnet to another computer from the
command prompt.
The availability of this command has only been listed as
Windows 2000 and Windows XP because these are the only two
versions of Microsoft Windows that support the telnet command
from the command prompt (with additional switches).
Additional information and help about using telnet from any
version of Windows can be found on our telnet help page.
tracert
The tracert command is used to visually see a network packet
being sent and received and the amount of hops required for
that packet to get to its destination.
Users with Microsoft Windows 2000 and Windows XP who need
additional information network latency and network loss should
also consider using the pathping command.
tree
Allows the user to view a listing of files and folders in an easy to
read listing.
undelete
Allows you to restore files that may have been deleted.
unformat
Used to unformat a drive that has been formatted.
xcopy
Xcopy is a powerful version of the copy command with
additional features; has the capability of moving files,
directories, and even whole drives from one location to another.