How to use CMD console and batch files

Content (Click to view)
  1. CMD
  2. What is the main function of the CMD console?
  3. Enable fast editing in the CMD console
  4. Open the CMD console with administrative permissions
  5. Simple tips for using the CMD console
  6. What is the difference between .BAT and .CMD files?
  7. You may be interested:

CMD

Below we explain precisely how to use the CMD console and batch files so you can understand it better.

You will also learn the difference between batch and BAT files and their practical uses in Windows.

If you are interested in this topic, we invite you to continue with the reading since it can be very useful when it comes to putting it into practice.

Photo Unsplash

You must take into account the main use of the commands available in Windows, because thanks to them you can execute almost all tasks and help you in your performance using this operating system.

However, the main tool to execute these commands is the CMD console so this topic is aimed at those individuals who have no experience at all, to get the basic notions needed before experimenting with these commands.

In this case we will try to explain everything clearly so that it can be assimilated by anyone without advanced knowledge, including those who panic towards the famous black window of MSDOS.

The Windows console in human words is a box where you can write commands to execute some actions in a non-visual way, you can navigate inside directories, create new ones, delete and many other things.

What is the main function of the CMD console?

The CMD console is the window of the Windows command prompt or System Symbol also known as the popular black window, through which any type of command can be sent to the operating system.

In fact, it initiates "cmd.exe" a 16-bit application found in C: WindowsSystem32, which translates and interprets commands transmitted to the operating system.

In addition, these commands are written in the old Windows MSDOS language, so through the CMD console you can perform tasks on the computer if you need to use the Windows graphical interface, because the received instructions go directly to the system kernel.

With the commands you enter and run on it, you can even perform virtually any type of action on Windows.

Now, the CMD console can be used in a similar way as it was done in the first operating systems, write a command or sequence and then press the Enter key to execute it.

It is worth clarifying that this method is somewhat cumbersome and complex, only for professionals, however the modern versions of Cmd.exe allow other options such as: copy or paste text into the console, just by clicking with the mouse, this option is called "Quick Edit" and must be enabled in the preferences.

Enable fast editing in the CMD console

In order to enable fast editing mode you must first access the console settings by right clicking on the top corner of the window and select: Properties -> Options.

Then tick the boxes: fast editing modes and insertion modes and finally save the changes. Remember that the console can also be customized, i.e. change the size of the window, position, text size, color, etc.

Another way to use the console is to do it indirectly using a batch file. This consists of typing instructions or commands in a text file that is saved with the CMD file extension.

Two clicks on the Windows file opens the console and executes the commands it contains. There are several ways to open or start the CMD console, so select the one that's easy for you:

  • In Windows 7: first look in the list All Programs -> Accessories: Command Prompt. Then type in the Run tool that opens using the Windows + R: CMD keys and press the Enter key. Finally type in the start box (Windows key) CMD: and press the Enter key.
  • In Windows 8: type on the start screen: CMD and press the Enter key, then type in Run: CMD and press the Enter key. Now open the Win-X menu (Windows + X keys) and select: "Command Prompt".
  • In the operating systems: here you must create a new shortcut on the Desktop, when you are asked the path, type: "cmd.exe". In the context menu of the mouse, i.e. when right-clicking with the Shift key pressed, select: "Start Command Window here".

Open the CMD console with administrative permissions

It is worth mentioning that some commands in Windows 7 and Windows 8 require the console to be started with administrator permissions.

But if this is not the case for you, a message similar to the following will be displayed: the command cannot be executed because the user does not have the necessary privileges to perform this operation.

Faced with this situation you do not have to worry, because there are several ways to solve it:

  • Create a shortcut on the desktop as above and run it as administrator (Right-click -> Run as Administrator).
  • In Windows 8, in the Win-X menu, select the option: "Command Prompt (Administrator)".
  • Then download to your computer and add the following key to the Registry, which will create a button in the context menu to directly open the CMD console with Administrator permissions.

Simple tips for using the CMD console

1. Paste a click on the console: to paste any text, for example an instruction copied from a web page, just right click with the mouse, it's that simple. In this case it is necessary to have enabled the Quick Edit Mode.

2. Copy a text into the console: to copy any text into the console, for example the help of a command, drag the mouse to select the entire text area and right click. Now open a document and press Control + V.

3. Enter the path to a file or folder in the console: if you need to execute an instruction in a folder or directory whose path is long or complicated, just open the folder, drag it and drop it on top of the console.

Regarding batch files, formerly known as BAT, we can say that they are small text files that can be done with any text editor, for example, with the note editor. However, it is necessary to change the original .txt file extension to .cmd or .bat, which work the same way.

When two clicks on them Windows moves the instructions that have written to the command console and are executed in this sequentially, ie line by line.

For example, if you write in the text file: COPY C:/test D:/ and save it as a batch, when you double click on it, Windows will copy the test folder located on disk C to drive D, in addition, the first line of the file must be: echo off.

Don't forget that if you're going to make batch files often, you can create a template, it's easy but it can be done. For that download the following script from the registry, unzip it and run it, it will add an entry in your context menu where you can choose: New -> Batch file.

It will create in the place that you choose a new file, which already will have the extension .cmd and the necessary heading, only you will have to insert the lines of code that you need to execute.

What is the difference between .BAT and .CMD files?

On previous systems, barch files were known as batch files and had the .bat file extension.

In addition, they were executed by command.com that by the way, reached very bad fame, even for many BAT were files that could either destroy your operating system or infest you with viruses, they were actually used a lot for this purpose.

But today with modern operating systems and the security systems they possess, an archaic virus in a batch file has no harmful effect.

From the Windows NT output the old command.com (16-bit command processor) part of the previous operating systems, becomes cmd.exe (32-bit command processor), a standalone application.

So now batches adopt the .cmd file extension, but the console continues to run for compatibility in the same way as those with the .bat file extension.

You may be interested:

If you want to know other articles similar to How to use CMD console and batch files you can visit the category Technology.

You may be interested in:

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Subir

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site, we will assume that you agree to it. You can also click Accept, to consent to the use of all cookies. Read More...