DOS Lesson 3: Internal Commands


Once your computer has completed the boot process (if you haven’t
done so yet, please review Lesson 2 for a discussion of the boot process), the
computer is sitting there waiting for you to do something. The way you do anything
in DOS is through commands
that the computer understands. A command may cause the computer to take some
action, or to execute some file. We’ll leave most of the file execution discussion
for another lesson, and for now focus on the topic of internal commands.

Internal vs. External Commands

As you will recall from Lesson 2, DOS comes with a built-in command
interpreter called COMMAND.COM. This file is loaded during the boot process,
which means that COMMAND.COM is resident in memory at all times, and the commands
that it understands are available to the user at all times. Not all DOS commands
are understood by COMMAND.COM. There are commands called external commands
that reside in separate files on your hard drive, and must be called specifically
for you to use them. Why is this?

One of the biggest reasons has to do with the limitations of how
DOS handles memory. A full discussion of this topic will come in a later lesson,
but for now it is enough to know that DOS could only address a very limited
amount of memory (1MB total), and that programs were very quickly bumping up
against the constraint of available memory. since COMMAND.COM is loaded into
memory at the beginning of the boot process, and stays resident in memory at
all times, it would not make sense to load commands that you would only use
infrequently, or to load commands that only certain users would ever need. So
these commands were placed in external files where they could be accessed if
needed. If you look in your DOS directory on your hard drive (usually C:\DOS),
you will see these external commands represented by files that are either *.EXE
or *.COM files. You won’t see the internal commands here, though, because these
commands are all contained within COMMAND.COM.

If you have created a DOS boot disk, which I recommend highly
to anyone who will be working with computers, it will contain three files, as
we discussed in Lesson 2: IO.SYS, MSDOS.SYS, and COMMAND.COM. The first two
files are hidden, so you won’t see them in a DOS dir comand normally.
But if you examine a boot disk in Windows 95’s Windows Explorer, and set it
to display all files (in Windows Explorer, select View, Options, and select
Show All Files), you will see them there. These files are located in specific
places on the disk. The third file, COMMAND.COM, must be in the root directory.
Since it is on the boot disk (you cannot boot without it), that means that the
commands it contains are available to you when you boot from this disk. The
reason any well-prepared computer person has a DOS boot disk handy at all times
is that a problem on the hard drive may render the computer unbootable. Booting
from a DOS boot disk and using the commands available to you in COMMAND.COM
may enable you to diagnose and fix the problem.

The other major reason why someone might want to create a DOS
boot disk these days is to run legacy DOS software that has problems running
with more current operating systems like Windows 95, 98, and NT.

One last note regarding internal commands. The internal commands
contained within COMMAND.COM are the commands that are used in writing batch
. We will discuss batch files more in a future installment, but one
consequence is worth noting here: the batch file will not run properly if it
cannot find COMMAND.COM. Normally this ought to be handled by the path
command, but if you ever have problems getting a batch file to run, try putting
a copy of COMMAND.COM in the same directory as the batch file. This often gets
the batch file to run perfectly.

List of Internal Commands

Here are all of the 62 Internal Commands contained within the COMMAND.COM command

break buffers call cd
chcp chdir choice cls
copy country ctty date
del device devicehigh dir
dos drivparm echo erase
errorlevel exist exit fcbs
files for goto if
include install lastdrive lh
loadfix loadhigh md menucolor
menudefault menuitem mkdir move
not numlock path pause
prompt rd rem ren
rename rmdir set shell
shift stacks submenu switches
time truename type ver
verify vol

Some of these internal commands (e.g. dir, cd) are meant to be executed from
the command line, or within a batch file, which is what you usually think of
as a command. Others (e.g. files, switches) are generally used within a configuration
file like CONFIG.SYS to help configure your system. Because both CONFIG.SYS
and AUTOEXEC.BAT use commands that are found in COMMAND.COM, they must load
later in the boot process. So if you were wondering why things happen in that
specific order in the boot process (discussed last week), now you know.