Best CMD Tricks for Windows

So that we grew them with MS-DOS, where all the actions had to be done through the command line, the graphical interface that came from the hand of Windows meant and progress in terms of interaction with the operating system, since it was not necessary pound the keyboard to do basic actions in the management of any operating system. However, today, we can still find a large number of functions that are only available through the CMD command line. If you want to know what the best CMD tricks are, I invite you to take a look at this article.

Best CMD Tricks for Windows

Despite the introduction of PowerShell, Microsoft continues to offer support for Command Prompt (CMD). In fact, using commands via CMD is much easier than using PowerShell. If you want to get the most out of the Windows command line, here are some tricks that you probably didn’t know about.

Before starting to test the CMD commands that we show you in this article, we must bear in mind that some require administrator permissions, so, to avoid problems, it is recommended to always run CMD with administrator permissions.

Always run CMD with administrator privileges

As I mentioned above, to interact with the Windows command line system, you need to have administrator permissions. To avoid having to close the command window and reopen it, we can configure the CMD operation to always run with administrator privileges.

To always run CMD with administrator permissions, we go to the Windows search box, type CMD and click on Open file location. Next, we click with the right mouse button and access properties.

cmd administrador

Within properties, on the Shortcut > Advanced Options tab, we check the Run as administrator box.

Create a document with the files in a directory

Creating a text document with the name of all the files that are part of a directory through CMD will allow us to list all the files included in a project in a much simpler way. This way, it will be much easier to check if all the files are included. To do so, we can use the following command:

dir /b >listado.txt

This code will create a plain text document called list.txt that will include a list (forgive the redundancy) with all the files, archives and directories found in the directory where we have executed the command.

From CMD to clipboard

Copying the text that is displayed on the command line after executing actions is a practically impossible mission if we are not used to it and have established a suitable routine. Fortunately, for this problem, there is a solution using the variable “| clip” next to the command.

For example, following the previous example, if we want the list of files from the previous example to be copied directly to the clipboard, we use the command from the folder where the files are:

dir | clip

Next, we open the application where we want to add the generated list and click on the Paste button. The symbol | will appear by pressing Alt Gr + 1.

Scan your hard drive for errors

Using the sfc command, the computer will analyze the integrity of the files, checking if there are damaged sectors, sectors that it will take care of repairing, and will create a log file with all the repairs it has made.

sfc /scannow

CMD sfc

If the drive shows a large number of errors and you can’t fix them all, it’s time to change the hard drive if you don’t want to lose the files stored on it.

Hide a file in an image

A feature that may be attractive to many users today is the ability to hide a file within an image . In this way, at first glance they open with any photo application, but, if you use the application of the file that hides, for example, Word, you will be able to access the text of the document if we have merged a Word document with an image. If we want to hide the softzone.doc document inside the vacation.png image, creating the resulting file hello.png , we use the command:

copy /b softzone.doc+vacaciones.png hola.png

Opening the hello.png document with any photo application will display the image included in the vacation.png file. If we open the file with Word, the text included in the softzone.doc file will be displayed.

What programs do I have installed?

CMD also allows us to create a list with all the applications that we have installed on our computer using the command

wmic product get name

cmd listado aplicaciones instaladas

But, in addition, we can also uninstall applications installed on the computer, although it is not a very intuitive process using the command:

wmic product where nombre-completo-de-la-aplicación call uninstall /nointeractive

By having to enter the full name of the application as it has been listed, uninstalling applications from CMD is not a recommended process and, by no means, fast.

Stops the execution of a command

Although the Esc button is the usual one to cancel a process during its execution, on the command line, it does absolutely nothing. If we want to stop an action, we must use the key combination Control + C.

What does each command do?

One of the most repeated commands when I was introduced to the world of MS-DOS computers was including the /? variable. in each and every one of the .exe and .com commands it encountered on the system. When entering this command behind an application, it shows all the options that the application offers you according to the variables that we introduce after its name.

dir /?

cmd ayuda

Using this command, the system will show us all the options available for the dir command that shows a list of files.

Function keys are keyboard shortcuts

The function keys at the top of the keyboard, above the number line, are command-line keyboard shortcuts . Each of the function keys is assigned different functions, although some are similar.

  • F1: When pressing this key, the last command that we have executed will be shown again, letter by letter.
  • F2: Copies the displayed command up to a specified character.
  • F3: Shows the complete previous command.
  • F4: Clears the displayed command up to a specified character.
  • F5: Every time we click on F3, the last commands used will be displayed.
  • F6: Enter the EOF flag in CMD.
  • F7: Shows a list of previously entered commands.

The use of these keys is especially useful considering that the copy and paste commands, as I explained above, is not an easy functionality to use on the command line.

Change the title of Command Prompt

When we open CMD, the text Administrator: Command Prompt or Command Prompt is displayed at the top of the window if we run CMD without administrator privileges. If you open different instances of CMD to perform different functions, changing the title of the window will allow you to identify it more quickly. Using the command

title softzone

cmd título ventana

The window will be renamed from Command Prompt to Softzone. This change will be removed once we close the command window.

What drivers do I have installed?

If your computer is experiencing a problem with the drivers and you prefer to find the solution through the command line, you can use this command to display a list of all the drivers installed on your computer.

driverquery /fo list /v

This list shows us the location of the driver on the computer, if it is running or stopped, the space it occupies on the computer, the date of the file, among others.