Where are the standard Windows prompt commands files?
Solution 1
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!
Solution 2
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:
- BREAK
- CALL
- CHCP
- CHDIR(CD)
- CLS
- COPY
- CTTY
- DATE
- DEL(ERASE)
- DIR
- ECHO
- EXIT
- FOR
- GOTO
- IF
- MKDIR(MD)
- PATH
- PAUSE
- PROMPT
- REM
- RENAME(REN)
- RMDIR(RD)
- SET
- SHIFT
- TIME
- TYPE
- VER
- VERIFY
- VOL
External Commands:
- APPEND.EXE
- ASSIGN.COM
- ATTRIB.EXE
- BACKUP.EXE
- CHKDSK.EXE
- COMMAND.COM
- COMP.EXE
- DEBUG.EXE
- DISKCOMP.COM
- DISKCOPY.COM
- DOSKEY.COM
- DOSSHELL.COM
- EDIT.COM
- EDLIN.EXE
- EMM386.EXE
- EXE2BIN.EXE
- EXPAND.EXE
- FASTOPEN.EXE
- FC.EXE
- FDISK.EXE
- FORMAT.COM
- GRAFTABLE.COM
- GRAPHICS.COM
- HELP.EXE
- JOIN.EXE
- KEYB.COM
- LABEL.EXE
- MEM.EXE
- MIRROR.COM
- MODE.COM
- MORE.COM
- NLSFUNC.EXE
- PRINT.EXE
- QBASIC.EXE
- RECOVER.EXE
- REPLACE.EXE
- RESTORE.EXE
- SETVER.EXE
- SHARE.EXE
- SORT.EXE
- SUBST.EXE
- SYS.COM
- TREE.COM
- UNDELETE.EXE
- UNFORMAT.COM
- XCOPY.EXE
Reference: Microsoft Support
Nota bene: The external commands reside in C:\Windows\System32
assuming the root drive is C:
.
Solution 3
Most standard "DOS" commands are built into the command shell in Windows. There isn't a dir
or cd
application
Solution 4
For additional reference, here is a nice website that fairly good list of commands available for cmd.exe:
Related videos on Youtube
Jader Dias
Perl, Javascript, C#, Go, Matlab and Python Developer
Updated on September 17, 2022Comments
-
Jader Dias almost 2 years
If I type
dir
in the command line, I guess it executes adir.exe
hidden somewhere in the system. Is there such a file? Where is it?-
Synetech about 13 yearsTechnically, the file is
cmd.exe
, though it’s not really being executed; it already was.;-)
-
-
Dennis Williamson over 13 yearsA +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.)
-
user1686 over 13 years+1 for an extensive list, but -1 for mixing MS-DOS and Windows command line shell.
-
Greg Jennings over 13 years@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.
-
Crippledsmurf over 13 yearsI'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
-
Community almost 3 yearsPlease add further details to expand on your answer, such as working code or documentation citations.