One of the applications most used by advanced users of the Windows operating system is the command prompt or CMD. This allows many tasks and operations to be performed command base. In fact, a command line interface is not just Windows’ own. All operating systems implement these types of applications as they are very useful. If you want to know what a command line interface is, as well as its characteristics and use in the Windows operating system, I recommend that you continue reading the following article.
CLI command line interface
A command line interface CLI It is a computer interface that makes it possible to indicate commands to certain programs. In addition, through this you can also give execution orders to the specific operating system. The way to give these commands is through simple text commands.
It is quite common to name the CLI as Shell or terminal emulator. However, these terms are not the same. In fact, a Shell or an emulator are computer applications used to implement a CLI. To execute commands through a CLI, these can be written interactively in some text input interface. You can also write commands in a file that is read by the CLI and executes the commands written in it.
This type of interface was one of the first applications for operating systems. Previously, punch cards or some similar mechanism were used to give instructions to the system.
There are many different CLIs with different functionality geared towards different operating systems or hardware items. For example, in operating systems it is common find CLIs implemented in desktop interfaces. The objective of this integration is provide functionalities that allow fast execution of some applications. The CLIs are also used in interpreters of interpreted languages such as Python, Java or Perl. Also included in applications database managers or version control, like Git.
Generally, A CLI is a critical part of large engineering applications and operating systems.
History of the Windows CLI command prompt or CMD
The Windows operating system implements a CLI from the very beginning. Within the family of Windows DOS systems, MS-DOS, a CLI called COMMAND.COM.
This was a shell for DOS and 16-bit and 32-bit versions of Windows 95, Windows 98, and Windows 98 SE. COMMAND.COM it was an inherent part of the operating system. In this way it was in charge of loading the system configuration by executing a file called AUTOEXEC.BAT.
This CLI had two modes of execution. The first was a interactive mode, by means of which the commands were written directly in the interface to be later executed. The other was to write a script of commands and save them in a .BAT file. Then this file was loaded by the predecessor of the command prompt to be executed.
In versions of Windows NT, Windows 2000, Windows XP, Windows 2003, Windows Vista, Windows 7, Windows 8, Windows 10 and Windows 11, COMMAND.COM it was replaced by the command prompt or CMD. However, in some versions the COMMAND.COM in order to provide compatibility with Windows DOS systems.
In the most modern versions of Windows we have the Windows PowerShell CLI. This is a more advanced command interpreter that could possibly replace the classic CMD in future versions of the operating system.
Windows Command Prompt or CMD Commands
Using the command prompt or CMD you can run internal commands with different functions. These can be as complex as parameters you want to add, but they all have a basic function. The vast majority of these commands are aimed at automating tasks. This is accomplished by grouping a sequence of commands into command files. scripts or batch files. In this way it is even possible to carry out and schedule administrative tasks of the Windows operating system.
It is necessary to clarify that all the tasks that are executed by means of commands in the command prompt, can be executed by the graphical interfaces of other tools. In addition, between different versions of the Windows system some details regarding the syntax and meaning of the commands may change. Here is a list of the command prompt or CMD commands.
- ASSOSC: This command is used to change the associations referring to file extensions.
- ATTRIB: Used to display or change the attribute of a specific file.
- BREAK: It is analogous to pressing the key combination Ctrl + C. Terminates a batch run.
- CD “directory”: This command changes to the indicated directory.
- CD..: Change to the upper directory.
- CLS: It is used to clear the CMD or Command Prompt screen after executing various commands.
- CMD: It can be used to run a new instance of the command prompt or CMD.
- COLOR: This command sets the console font and background color. Once another instance of the command prompt or CMD is rerun, it takes the default color.
- DATE: used to set or display the system time.
- OF: Delete files.
- DIR: Shows all directories and files within the current CMD run directory.
- FOR: It is used to iterate over a set of files and execute a command for each of them.
- FTYPE: In a file association it is used to display or modify the types of files used.
- GOTO: In a batch file, it is used to direct the cursor to a specific line previously identified by some marker.
- HELP: Displays system help for all executable commands from the Command Prompt or CMD.
- IF: It is responsible for executing conditional processing in a command batch file.
- IPCONFIG: It shows network configuration parameters such as IPV4 and IPV6 address, subnet mask, MAC address of the computer, default gateway, among others.
- LABEL: It is used to change, create or delete the label of a specific disk drive.
- MD and MKDIR: They create a directory at a specific address.
- MOVE: Used to move files from one directory to another.
- PATH: Used to display or create a search path for executable files.
- PAUSE: Momentarily stops executing batch commands displaying an informational message.
- POPD: it is responsible for restoring the value of the current directory saved by the PUSH command.
- PUSH: Saves the value of the current execution directory and then changes it.
- RD and RMDIR: Delete a specific directory.
- REN and RENAME: The name of one or more files fit.
- REPLACE: Used to replace files.
- SET: Used to set and delete environment variables of the operating system.
- START: This command launches a new command prompt or CMD window for executing commands.
- TIME: Sets or displays the system time.
- TITLE: Used to modify the name of the current CMD window.
- TYPE: It is used to display the content of a file, generally text.
- SEE: It is used to show the version of the Windows operating system that is running.
- VERIFY: This command is used to enable or disable the checking of files that will be stored on disk.
- VOL: To display the label and volume of the hard disk.
- EXIT: Closes the current execution of the command prompt or CMD.
- SHUTDOW: Turn off the computer.
How to run the commands at the command prompt or CMD
Most of these commands have more specific functions according to parameters and options that are included in the command statement. To execute a command it is only necessary to access the command prompt or CMD.
For this you can type CMD in the start menu and select “Symbol of the system”.
You can also access the function “run”From the system using the key combination Windows + r and typing “CMD”.
Once the terminal is open, simply type the command and press Enter.
Command batch files
Writing and executing commands using the command prompt or CMD cannot only be done interactively. It also reads and executes files .exe. In addition, it interprets and executes a script made up of commands and saved in a file .bat or .sys. These files can be modified by common text editors like Notepad ++ or Blog Notes.
As an example, if in a text file we write:
DEL C: file.txt.
MKDIR E: FILES
And we save the file with extension .bat, once we execute this file, the file will be deleted file.txt and the directory will be created “FILES” in volume “AND” of the disk.