Discussion Locked

Dos commands

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
If I had three files all named the same and placed in the root directory, which order would they follow if the extensions were .com, .exe, and .bat.? Example: run.com, run.bat, and run.exe.

7 replies

by thechas

I put all my DOS books away in storage.

The hierarchy of the extensions is:

.com
.exe
.bat

What I'm not sure about, is if you simply type your file name (run) and press enter, will DOS follow the hierarchy, or will it execute the first program that it finds.

I know that DOS does display files by the date they were added to the directory unless a directory sort has been performed, and then, the files will be listed in the order defined by the sort.

In the DOS de-fragmenter programs, you had the option to sort the files in specific orders.

So, it is either by the hierarchy, or the order the files are listed in the FAT.

If you need to assure that the programs are always executed in a specific order, you will need to usea batch file that lists them in the sequence desired.

If I find my DOS books before you get a better answer, I will add a comment.

Chas

by ann777

http://www.dcs.napier.ac.uk/~tim/css/tut5/tut5.htm

See the above

Section 1 --> number 2:

"if it is not an internal command then the command interpreter looks in the current directory for a file with same name as the command and the extension bat. If it does not find this it then tries extension com and then exe. If it finds the appropriate file it assumes it stores a program, loads it into memory and executes it. (Note: if the command name includes an extension bat, com or exe then this will override the search order given above.)

Please remove any embedded spaces from the above link when pasting it into your browser. There are many more tutorials linked from the above tut.

by fenaikh

Hi
I gues you ment which will execute first then the answer is:

1. run.bat
2. run.com
3. run.exe

Good luck

Mohamed

This discussion is closed to new replies.