# [Solved] dos commands



## bobh21uk (Mar 10, 2004)

Hi all, I'm just starting an IT course and would be grateful for some help...Question. A path of C:\DOS;C:\WINDOWS exists on the computer. You type in the command CHECKIT and the file CHECKIT.TXT exists in the C:\WINDOWS directory. Explain the steps the computer would go through to try and interpret this command and also what the final result would be....BE needing your help again soon probably....lol


----------



## brushmaster1 (Jun 15, 2002)

Actually, the result would be "BAD COMMAND OR FILE NAME"... a .TXT file is not executable.


----------



## Rockn (Jul 29, 2001)

It's not a system command is why it will not work. It has to be a part of the command interpereter or you will egt the message brushmaster stated.


----------



## cpuhack.com (Apr 25, 2002)

lol, sounds like the cert courses have some trick ?'s...


----------



## bobh21uk (Mar 10, 2004)

Thanks.....But what steps does the computer go through to interpret his command....Does it just search through the windows and dos directories.....


----------



## brushmaster1 (Jun 15, 2002)

I'm not sure it goes through any steps beyond being incapable of executing a non-executable file. I think when you hit enter, DOS looks to see if what you typed at the prompt is executable, and then goes no further.

...I could be wrong on this.


----------



## AbvAvgUser (Oct 3, 2002)

I agree with brushmaster1.

1. First DOS checks to see if it is an executable file.
2. If it is, then it first goes thru the current directory.
3. If it is not found there, it will see the first directory mentioned in the path variable.
4. If its not in first, then it looks for it in second and so on.

If it is not an executable file, it gives an error "Bad Command or File Name".


----------



## bobh21uk (Mar 10, 2004)

I Understand now. Thanks for your help guys. I'll be back soon with more problems.


----------



## AbvAvgUser (Oct 3, 2002)

You are welcome. Looking forward to solving some more DOS problems. There are very few people who are still interested in DOS


----------



## oabrar (May 25, 2004)

bobh21uk said:


> Hi all, I'm just starting an IT course and would be grateful for some help...Question. A path of C:\DOS;C:\WINDOWS exists on the computer. You type in the command CHECKIT and the file CHECKIT.TXT exists in the C:\WINDOWS directory. Explain the steps the computer would go through to try and interpret this command and also what the final result would be....BE needing your help again soon probably....lol


----------



## AbvAvgUser (Oct 3, 2002)

Its a .txt file and therefore cannot be executed or run in DOS. DOS can run only .exe, .com and .bat files. Steps the computer would go thru are as follows

1. It will first check if it is a DOS command to be run from memory.

2. If it isn't then, in the *current directory* It will look for a file called checkit.exe. If not found, look for checkit.com. If still not found look for checkit.bat. (I am not too sure which type it looks for first. May be it looks for .com first and then .exe or some other sequence. Will have to try this out).

3. If none of the files are found in the current directory, it will look for them in the same sequence in C:\DOS.

4. If it is not found even there, then it will look for them in C:\Windows.

5. If it is not found even there, it will display a message of *Bad Command or File Name*.

The later part of the error message is applicable here. It is just a file name. In DOS, trying to open a file doesn't automatically open the corresponding application and that is why only command or executable files (.exe, .com and .bat) can be run.


----------

