How-to: Internal commands

The Windows CMD shell CMD.exe contains a number of 'internal' commands, additional 'external' commands are also supplied as separate executable files. External commands are generally stored in the C:\WINDOWS\System32 folder, this folder is part of the system PATH .

This arrangement means that both internal and external commands are always available no matter what your current directory happens to be.

ASSOC, BREAK, CALL ,CD/CHDIR, CLS, COLOR, COPY, DATE, DEL, DIR, DPATH, ECHO, ENDLOCAL, ERASE, EXIT, FOR, FTYPE, GOTO, IF, KEYS, MD/MKDIR, MKLINK (vista and above), MOVE, PATH, PAUSE, POPD, PROMPT, PUSHD, REM, REN/RENAME, RD/RMDIR, SET, SETLOCAL, SHIFT, START, TIME, TITLE, TYPE, VER, VERIFY, VOL

In the main A-Z list of CMD commands the internal commands are indicated with a •

When you are working from any other shell, such as PowerShell then none of the internal commands are available unless you first open a CMD shell.

Passing arguments

Arguments can be passed to an internal command, just like an external command, e.g. COPY /Y
In some cases (when the command is being parsed by CMD.exe) the space before each argument can be omitted e.g. COPY/Y this can save time when working at the command line, but for scripts and scheduled tasks it is better to include the space.

for example from PowerShell:

PS C: > cmd /c date /t

will launch a CMD shell, run the DATE /T command and then exit back to PowerShell. Of course in many cases this is not neccessary, (PowerShell has its own Date command) but can be useful if you need to run something 'the old way'.

It is possible for a system to have an internal command and an external command with the same name. If you have a command called DATE.exe and want to run that in preference to the internal DATE command, use the full pathname to the file e.g. C:\utils\date.exe even if your current directory is C:\utils\

“Tongues, like governments, have a natural tendency to degeneration; we have long preserved our constitution, let us make some struggles for our language” - Samuel Johnson: Preface to the Dictionary

Related commands

Which.cmd - Show full path to executable.
How-to: Escape Characters, Delimiters and Quotes


 
Copyright © 1999-2024 SS64.com
Some rights reserved