internel & external commmands

joinqamar
joinqamar used Ask the Experts™
on
what is the difference b/w an external commands and internel commands.how a given command of ms doc  can be differentiate as internal or external.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Internal commands are part of the command interpreter command.com. For example copy is an internal command, there is no copy.com or copy.exe. Format is an external command, format.com is a separate program.
dbruntonQuid, Me Anxius Sum?  Illegitimi non carborundum.

Commented:
To differentiate whether  a command is internal or external, you would need to disable the path command.

Do that by issuing the command

set path=

at the dos prompt.

Then try all your dos commands at the dos prompt (make sure you are in the root folder when you do this) such as

format /?
copy /?
mdir /?

If you get a message back such as

Bad command or file name

then you know it is an external command.
Go to your DOS directory (like C:\DOS)

>dir /ON /B *.exe |more

ATTRIB.EXE
CHKDSK.EXE
...

Lists all the "external" DOS commands... as they are just
programs.
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

Commented:
Hi,

The difference between external and internal commands: Simple.

DOS is centered around a file called COMMAND.COM. This is what is called the Command Interpreter. The command interpreter is what generates the C:\> and interprets what you type in.

COMMAND.COM is a stand alone program that contains inside a collection of commands (Copy, ren, delete, mk, cd, rm, dir, path, set...). One file library, several commands. These are the internal commands.

The other commands, like fdisk, format, attrib, setver, smartdrv, scandisk... are contained inside a seperate program, generally in the DOS directory. One command per program. These are the external commands.

So, an internal command is a command contained within the DOS command interpreter (COMMAND.COM), and an external command is a command that is contained within it's own seperate executable file.

Commented:
So as mentioned above, if you can see a program in your DOS directory, it is external, if you use a command but cannot find the associated program, it is internal.

Commented:
Sorry, I am not awake yet :)

DOS differenciates between an internal and external command in the following way:

1) command.com reads the command entered at the prompt
2) it checks what was entered against it's list of internal commands, and executes it if it is found (internal)
3) if not found, it will then check the current directory for an external command by that name, and executes it.
4) if it is not found, it will check the directories specified in the PATH variable for an external command by that name, and executes it.
5) If it is not found, it then displays the ubiquitous :

"Invalid command or file name"

Commented:
it's been awhile and I don't have a DOS machine with command.com accessible at the moment to verify, but there is a way to list all of the internal commands. It looks something like one of the following:

   command /?
   command commands
   help command.com

otherwise, what everybody else said.

cheers,

-matt
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- Points to jbuttery
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
pbarrette
Commented:
jbuttery answered the first part of the question (what is the difference), but not the second (how do I tell which is which).

bpfh also answered the first part, but with more detail. I consider it the best (most complete) answer for part one.

No single person answered "how do I tell which is which" completely, but a synthesis of several the answers yields a complete answer.
1) with no %PATH% "bad command error = external",
2) dir c:\dos\*.exe, *.com
3) "command /?", "help command.com", etc.

As for assigning the points: bpfh is most deserving. Although his answer was not comprehensive it was the single most comprehensive and he did try the hardest (3 separate posts).

-matt

Commented:
joinqamar,
No comment has been added lately (49 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

RECOMMENDATION: split points between jbuttery, maphew

Please leave any comments here within 7 days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thanks,

cempasha
EE Cleanup Volunteer
---------------------
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post a request in Community support (with a link to this page) to refund your points. http://www.experts-exchange.com/Community_Support/

per recommendation

jbuttery, points for you at:
http://www.experts-exchange.com/Operating_Systems/MSDOS/Q_20596860.html

SpideyMod
Community Support Moderator @Experts Exchange

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial