This document discusses internal and external commands in an operating system. Internal commands are built into the OS and available anytime, while external commands must be loaded from disk as needed. Commands have three parts - a keyword to specify the action, a parameter to specify the target of the action, and optional switches to modify the action. Common commands include DIR, COPY, DEL, and FORMAT.
3. 3
Internal Commands
Built into the OS.
Already in memory if the OS is loaded.
Available anytime the computer is
displaying a command prompt.
Generally, the more frequently used
commands.
Examples include: DIR, COPY, PATH, CD,
MD, DEL, TIME, DATE.
4. 4
External Commands
Not a part of COMMAND.COM.
Located in another directory.
Must be loaded into memory as needed by
the OS.
Examples include: FORMAT, DEFRAG,
DISKCOPY, MEMMAKER, and
SCANDISK.
5. 5
Syntax
A specific set of rules that you must follow
when writing commands.
The order in which you arrange the
elements of the command.
The rules of grammar for the command line.
7. 7
Keyword - What action to perform.
Parameter - What is acted upon.
Switches - How to perform the action.
8. 8
Keyword
A unique word or set of characters that
identifies the action to be performed.
Some are quite descriptive: FORMAT,
COPY, MOVE
Others are abbreviated: DEL, DEFRAG,
DBLSPACE
A few are little more than memory aids:
EMM386 and MSCDEX.
9. 9
Parameter
Additional directions for the command.
It may specify a directory or file on which
to perform the action.
It may specify a hardware device.
It may specify a system setting.
10. 10
Switches
A special type of parameter that enables or
disables optional functions of the command.
The /P switch with the DIR command
displays the directory one screen at a time.
The /W switch with the DIR command
displays the directory in the wide format
(five columns wide).
11. 11
Two Common Forms of
Commands:
Keyword Drive/Files Switches
Or
Keyword Source Files Switches
Target Files
17. 17
Backslash Vs. Forward Slash
Backslashes are used as separators
when specifying directory or file
information.
/ Forward slashes are used to notify DOS
that the next character is a command line
switch.
19. 19
Getting Help.
Type HELP followed by the command you
want to know about.
Type the command and then follow it with
the switch /?.
Editor's Notes
In this lab, you will study the command line, concentrating on its command structure and its syntax. In the hands-on part of the lab you will begin using some of the commands, with special emphasis on wild card features.
There are two types of commands, called internal and external. It is important that you understand their differences.
The internal commands are an integral part of the operating system. Because the internal commands are part of the OS they are already in memory anytime that OS is loaded. Originally, the idea was that these are the most frequently used commands and time could be saved by making them part of COMMAND.COM. A few examples of internal commands are listed here. Altogether, there are about two dozen of these internal commands.
External commands are not part of COMMAND.COM, or the OS. Instead, they are separate programs that are not normally in memory. In fact, they generally reside in a directory on the boot drive. A few examples of external commands are listed here. But this list is by no means complete. Most commands are external commands. Because they are not normally in memory, they must be loaded into memory before they can be executed.
One of the things that we will be discussing in this and future labs is the syntax of the command. Syntax is simply a fancy word for a set of rules that we must follow when writing commands. It has to do with the order of the different elements that make up the command. You can think of syntax as the rules of grammar the command line.
Commands are made up of one, two, or three parts as shown here. The three basic parts are called the Keyword, the Parameter, and the Switches. The last two parts are optional. One or both may not be needed with some commands.
A good way to think of these three elements is like this. The Keyword tells what kind of action is to be performed. The Parameter tells what the action will be performed upon. And the Switches tell how the action will be performed. Let’s take a closer look at each of these.
The Keyword is a unique set of characters (usually two to eight characters) that tells what action is to be performed. Some are English words that mean more or less what they say such as Format, Copy, and Move. Others are abbreviations such as DEL for delete, DEFRAG for defragment, and DBLSPACE for double-space. Still others are simply memory aids that convey as much meaning as possible in a few characters such as EMM386 and MSCDEX.
The Parameter provides additional information. It specifies what will be acted upon. This may be a file, a directory, a hardware device, or a system setting. Most often it indicates a specific file that is to be acted upon.
Most commands have several different ways of carrying out their action. The switches tell the command how it will perform its action. Switches enable or disable certain optional functions of the command. For example, when you ask for a directory listing, you can specify the form the listing will take. The slash-P switch displays the directory one screen at a time. The slash-W switch displays the directory in a wide format.
Most commands will take one of these two basic forms. Notice that both use a keyword. In fact, every command requires a keyword. In the first example, the parameter indicates the drive and the file that is to be acted upon. In the second example, both a source file and a target file are indicated. The difference between these two can be better understood by considering some examples.
Let’s suppose you find a file called SALES95.DOC. Let’s assume that this is an old sales report that is no longer needed and you want to erase it to free up disk space. The command shown here will do that. The keyword is DEL, which is short for DELETE. What action is to be performed? Delete. What is to be deleted? The file called SALES95.DOC. Because you gave no details about where the file is located, the OS assumes that it is in the current directory. That is, if you are currently in the C:\BUSINESS directory, the OS assumes that it will find the file called SALES95.DOC in that same directory. If SALES95.DOC is located somewhere else, you must tell the OS exactly where it is.
For example, let’s suppose the file is on a floppy disk instead of the hard drive. In this case you place the floppy disk in drive A and then inform the OS as shown here. It will look for and delete the file called SALES95.DOC on the disk in drive A.
With many commands you must be concerned with both a source file and a target or destination file. Here is an example. Suppose you wish to share a file called FILE13.TXT with a friend. An easy way to do this is to copy it to a floppy disk using the command shown here. The keyword is COPY. That is the action to be performed. The file that is to be acted upon or copied is FILE13.TXT. This is called the source file. You must also tell MS-DOS the destination or target to which you wish to copy the file. In this case, it is drive A, which is indicated by the “A:” at the end of the command.
Notice that blank spaces are used to separate the parts of the command. There must be a space between the keyword and the source and again between the source and the target.
Here we see the same command but with a switch added. The slash V at the end of the command tells the OS to verify that the copy has been recorded correctly.
When you first begin working with the command line it is easy to confuse the backslash with the slash. It is important to realize that these are entirely different characters that are used for entirely different purposes. The backslash is used as a separator in the file path. The forward slash is used to identify switches.
The command line is intolerant of errors in syntax. If you so much as leave out a space or use a slash where you should use a backslash, the OS will probably give you a simple error message like this one. When you see this message, and you will see it frequently when you are first starting out, go back and look at your command syntax.
Sometimes, in spite of your best efforts, you will need help with a command, especially when first starting out. Fortunately, the OS provides you with an on-screen alternative. Its built-in, on-line Help system provides a wealth of information about the various commands.
There are two ways to access this information. One way is to type the word HELP followed by the command keyword. Another way is to use the switch “slash-question mark” at the end of the command line. You will experiment with both these techniques in the hands-on portion of the exercise.