Open In App

What is an Internal Command?

Last Updated : 04 Apr, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

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

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

echo command

echo command

2. 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'

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 command

mkdir command

It 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.

Frequently Asked Questions on Internal Command – FAQs

How can I get help with internal commands?

Most command interpreters provide built-in help systems to assist users with internal commands. In Windows Command Prompt, you can use the help command followed by the internal command name to display usage instructions and options.

Can I modify internal commands?

No, internal commands are part of the operating system’s core functionality and cannot be directly modified by users.

What if I need functionality beyond what internal commands offer?

This is where external commands come in. External commands provide a wide range of functionality beyond what internal commands can offer. You can find many external commands pre-installed on your system or by downloading them from third-party sources.

Are internal commands safe to use?

Internal commands are safe to use as they are designed for basic system administration tasks. Although, some internal commands, like del (delete), can cause data loss if used incorrectly. It’s always a good idea to double-check the command and its arguments before execution, especially when dealing with commands that modify files or system settings.

Can I create my own internal commands?

No, you cannot directly create new internal commands that are built into the operating system shell.

Are internal commands case-sensitive?

In most operating systems, including Windows, internal commands are not case-sensitive. So, typing commands in uppercase, lowercase, or a combination of both will produce the same result.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads