20
6
If I type dir
in the command line, I guess it executes a dir.exe
hidden somewhere in the system. Is there such a file? Where is it?
20
6
If I type dir
in the command line, I guess it executes a dir.exe
hidden somewhere in the system. Is there such a file? Where is it?
10
Dir
is an internal command, like cd
, copy
, and call
. This is simply a subroutine of the DOS interpreter that you're calling.
There are, however, external commands. These commonly reside in C:\Windows\
C:\Windows\System\
C:\Windows\System32
and (if you have 64-bit windows) C:\Windows\SysWOW64\
However, external commands are not limited to these locations. External commands can be called from the directory that you're working from. (in a newly started DOS shell on Windows 7, this would usually be C:\Users\YourUsername\
). External commands from other directories can also be called, as long as the directory they're in are in your PATH
environment variable. To see what directories are in your path, use SET PATH
.
If you're going to be needing some utility from a directory, but will have to be traversing to other directories, you can add the folder of the utility to the PATH
by using SET PATH=%PATH%;DriveLetter:\Utility\Path\Here\
. This change only affects that DOS window.
I hope that's new and useful knowledge!
37
dir is an internal MS-DOS command. Like the other internal commands, it is built into the file named command.com. Wikipedia has a page for the list of DOS commands, and it says:
The command interpreter for MS DOS runs when no application programs are running; after an application exits, if the memory used for the command interpreter was overwritten, MS DOS will re-load the command interpreter from disk storage. The command interpreter is usually stored in a file called "COMMAND.COM". Some commands are built-into COMMAND.COM. When the user types a line of text at the operating system command prompt, COMMAND.COM will parse the line, and attempt to match a command name to a built-in command or to the name of an excecutable program file or batch file on disk. If no match is found, an error message is printed and the command prompt is refreshed.
Resident commands varied slightly between revisions of MS DOS. Typically, the functions DIR (list directory), ERASE or DEL (erase a file or directory), COPY (copy files), DATE (display or set date), TIME (display or set time), CD (change working directory), MD (make a directory on the current disk), REN (rename a file or directory) and some others were resident in COMMAND.COM.
To make my answer complete, the following is a list of MS-DOS internal and external commands. The internal commands reside in COMMAND.COM, which loads into memory when the computer system is started; these commands do not reside on disk. The external commands are files that do reside on disk and have an extension of .COM, .EXE, or .BAT. Both command types are executed from the MS-DOS prompt.
Internal Commands:
External Commands:
Reference: Microsoft Support
Nota bene: The external commands reside in C:\Windows\System32
assuming the root drive is C:
.
A +1 for you if you address the OP's unstated part of the question with regard to where the external utilities reside. (It's a very good answer so far, by the way.) – Paused until further notice. – 2011-01-06T20:50:54.560
4+1 for an extensive list, but -1 for mixing MS-DOS and Windows command line shell. – user1686 – 2011-01-07T06:17:05.533
@Dennis: You're welcome, and thank you for reminding that. @grawity: Can you please drop a few lines to clarify the confusion? I really don't see what part of my answer is lacking. – Mehper C. Palavuzlar – 2011-01-07T07:44:26.583
5I'm not sure if this is exactly what grawity is aluding to but command.com was the name of the native DOS command-line shell. It was included in Windows 9x as that generation of windows was dependent upon DOS for certain services. Windows NT is not at all dependent upon DOS and so command.com is not present, the shell in NT is a native windows application called cmd.exe located in %WINDIR%\System32 – Crippledsmurf – 2011-01-07T08:35:49.457
10
Most standard "DOS" commands are built into the command shell in Windows. There isn't a dir
or cd
application
2
For additional reference, here is a nice website that fairly good list of commands available for cmd.exe:
1Technically, the file is
cmd.exe
, though it’s not really being executed; it already was.;-)
– Synetech – 2011-06-12T03:57:13.573