What is an Internal Command?
Last Updated :
04 Apr, 2024
DOS Commands are important instructions for managing files and directories in Windows. They're case-insensitive and follow the 8-dot format for file names. Each file has a primary name (up to 8 characters) and a secondary name (up to 4 characters with a dot). Common secondary names include .txt for text files, .com for command files, .sys for system files, and so on.
Special characters like < > , . / * ? | & Space are not allowed in file or directory names.
Internal commands are integral to Windows, embedded in the command.com file, and easily accessible. They're important for smooth operation and are always available, whereas external commands are effective tools that can fix issues, enhance performance, and perform different actions. They're stored individually from internal commands to reduce system load. You can add external commands to Windows by copying their files to your computer when needed.
Types of Commands
Commands are classified into two types:
1. Internal Commands: These commands are part of the operating system and reside within COMMAND.COM or cmd.exe. When you execute an internal command, MS-DOS executes it immediately. They're always available as part of the shell and don't require independent files.
2. External Commands: These commands are for advanced tasks and require external file support as they're not stored in COMMAND.COM. They're stored separately and can be added to Windows as required.
Additionally, there are Batch files containing lists of internal and/or external commands executed sequentially when the batch file runs. AUTOEXEC.BAT automatically executes on booting.
What are Internal Commands?
Internal commands are instructions that are integrated directly into the operating system's shell, as opposed to external commands. These commands are implemented directly within the shell or command interpreter and provide users with basic operations to manage files, directories, processes, and system configurations without invoking external programs.
When a user types an internal command at the prompt (e.g., C:\>), the shell recognizes the command and executes it directly without needing to load an external program. This makes internal commands generally faster to execute than external commands.
Characteristics of Internal Commands
- Resident in memory: Internal commands are loaded into memory during system startup and remain there until the system is shut down.
- Fast execution: Because they don't require loading a separate program, internal commands typically execute much faster than external commands.
- Limited functionality: Internal commands are generally designed for basic tasks like file management, directory navigation, and system configuration. For more complex functionality, external commands are typically required.
Primary Terminologies
- Operating System: It is a software that manages hardware resources and provides services for computer programs.
- Command-Line Interface (CLI): It is text-based interface for interacting with a computer's operating system or software.
- Shell: It is a program that interprets commands entered by users and executes them.
Where are Internal Command Files Stored?
Internal command files are stored directly within the COMMAND.COM binary. This means that the binary executable file, COMMAND.COM, contains the code for all internal commands. When the operating system loads COMMAND.COM into memory, it also loads the internal commands stored within it. This integration allows the internal commands to be readily available whenever the command interpreter is invoked.
The COMMAND.COM binary is typically located in a specific directory reserved for system files, such as the root directory of the system drive (e.g., C:\ in MS-DOS or Windows). It is a important component of the operating system's command-line interface, responsible for interpreting and executing commands entered by the user.
Since internal command files are part of the COMMAND.COM binary, they are always accessible without the need for additional loading or configuration steps. This ensures that users can quickly execute common commands directly from the command prompt, contributing to a seamless and efficient command-line experience.
Internal Commands Examples
There are many internal commands available, depending on the specific operating system. It is not case-sensitive, so user can type in any case be it upper or lower case.
Command
| Description
| Syntax
| Example
|
---|
BREAK
| Controls program interruption handling with Ctrl+C or Ctrl+Break.
| Ctrl+C or Ctrl+Break.
| Ctrl+C
|
CHCP
| Displays or modifies the current system code page.
| CHCP [code_page_number]
| CHCP
|
CHDIR
| Changes the current working directory.
| CHDIR [drive:][path] or CD [drive:][path]
| CHDIR C:\Test
|
CD
| Displays the current directory or changes the current directory.
| CD [drive:][path] or CHDIR [drive:][path]
| CD C:\Test
|
CLS
| Clears the screen.
| CLS
| CLS
|
COPY
| Copies one file to another.
| COPY source destination
| COPY file1 file2
|
CTTY
| Sets the input/output device.
| CTTY device
| CTTY CON
|
DATE
| Displays or sets the system date.
| DATE [date]
| DATE
|
DEL
| Deletes a file.
| DEL filename
| DEL file.txt
|
ERASE
| Deletes a file.
| ERASE filename
| ERASE file.txt
|
DIR
| Lists files and directories in the specified directory.
| DIR [drive:][path][filename] [/options]
| DIR
|
ECHO
| Toggles text display or displays text.
| ECHO [text]
| ECHO Hi
|
EXIT
| Exits the command interpreter.
| EXIT
| EXIT
|
LOADHIGH/LH
| Loads a program into upper memory.
| LH
| LH
|
MKDIR
| Creates a new directory.
| MKDIR directory
| MKDIR C:\NewDir
|
MD
| Creates a new directory.
| MD directory
| MD C:\NewDir
|
PATH
| Displays or sets the command search path.
| PATH [path]
| PATH
|
RENAME
| Renames a file or directory.
| RENAME oldname newname
| RENAME file.txt file2.txt
|
RMDIR
| Removes an empty directory.
| RMDIR directory
| RMDIR C:\OldDir
|
SET
| Sets or displays environment variables.
| SET [variable=value]
| SET PATH=C:\
|
VOL
| Displays volume information.
| VOL [drive:]
| VOL C:
|
Working of Internal Command
- You open the command shell application (e.g., Command Prompt).
- You type an internal command (e.g., DIR) and press Enter.
- The command shell recognizes the internal command because it's part of its built-in library.
- The command shell executes the instruction directly without needing to load any external files.
- The results of the command are displayed on the screen (e.g., a list of files in the current directory for the DIR command).
Execution of Internal Command
1. echo
The cd (change directory) command in Unix-based operating systems allows you to navigate through the directory structure.
The basic syntax for echo is:
echo [text to display]
echo command2. cd
This command stands for change directory and is used to navigate between different folders or directories in the file system. The basic syntax for cd is as follows:
cd [directory]
Replace [directory] with the name of the directory you want to navigate to.
Example:
command 'cd'
This command changes the current directory to "pyfile" if it exists within the current directory.
3. mkdir
It Stands for "make directory" and is a command-line utility found in Unix-based operating systems (including Linux, macOS, and some versions of DOS) that allows you to create new directories (also called folders in graphical user interfaces).
The syntax for mkdir is:
mkdir [directory name]
In this, you can replace [directory name] with the desired name you want to create.
Example:
mkdir commandIt verifies if a directory with the specified name already exists in the current working directory (the directory you're currently in). If the directory doesn't exist, mkdir creates a new directory with the given name in the current working directory. By default, the newly created directory inherits permissions from its parent directory. This means users who have permission to access and modify the parent directory will likely have the same permissions for the new directory.
Difference Between Internal and External Command
Internal Command
| External Command
|
---|
Internal command executed by the operating system directly.
| The user needs to load them explicitly.
|
It has faster execution than external command.
| It's execution is slow.
|
Internal command stored in RAM.
| External command stored in a hard drive.
|
Internal command is a part of the shell.
| It requires a path for execution.
|
This is built-in into the command prompt.
| External command is not built-in into the command prompt
|
You can use the "type" utility to determine if a command is internal or external. If it's internal, the output will indicate it's a shell builtin. If it's external, the output will provide the path to the command.
Similar Reads
What is a Command? A command typically refers to an order given to a computer program or operating system to perform a specific task. It's usually entered via a command line interface or a terminal. Commands can vary widely depending on the context, the operating system being used, and the specific program or utility
5 min read
What is Command Line Interface (CLI)? Command Line Interface is used to communicate with a computer program, you can input text into a by typing command lines. In this article, we will understand the workings of the command line interface, features of the command line interface, and more. What is the Command Line Interface?Command line
6 min read
What is a Command Prompt? We need tools to interact with the operating system of the computer. This is where Graphical User Interface and Command Prompts come into play. Graphical User Interface allows users to interact with the Operating System for simple tasks. Command Prompts are used for complicated tasks like batch proc
4 min read
What are ETH Internal Transactions? Internal transactions in Ethereum refer to the transactions that occur within smart contracts, rather than between externally owned accounts. Unlike standard transactions that directly transfer Ether or tokens between users, internal transactions are triggered by the execution of smart contract code
11 min read
Command Pattern | C++ Design Patterns The Command Pattern is a behavioral design pattern that focuses on encapsulating a request as an object, thereby decoupling the sender of the request from the receiver. This pattern allows you to parameterize objects with commands, delay or queue a request's execution, and support undoable operation
7 min read