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.
Within properties, in the Shortcut tab > Advanced options, check the Run as administrator box.
Clear command line screen
When we start testing commands in CMD and the only thing we get is that errors are displayed because we don’t know how they work, if we want to make a clean slate by deleting the screen content, instead of closing and reopening the application, we can use the command cls (clearscreen).
cls
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 easier way. In 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 >list.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 the Alt Gr + 1 key.
Scan your hard drive for errors
Using the sfc command, the computer will analyze the integrity of the files checking if there are bad sectors, sectors that it will take care of repairing and will create a log file with all the repairs it has done.
sfc /scannow
If the unit shows a large number of errors and cannot fix them all, the time has come to change the hard drive if we do not want to lose the files stored inside it.
Hide a file in an image
A functionality that for many users can be attractive today is the possibility of hide a file inside 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. We have merged a Word document with an image. If we want to hide the document softzone.doc inside the picture vacation.png creating the resulting file hello.png we use the command:
copy /b softzone.doc+holidays.png hello.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
But we can also uninstall apps installed on the computer, although it is not a very intuitive process using the command:
wmic product where full-application-name 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 far from fast.
Stops the execution of a command
Although the Esc button is the usual one for cancel a process throughout its execution, on the command line, it does absolutely nothing. If we want to stop an action, we must use the Control + C key combination.
What each command does
One of the commands that he repeated the most when he introduced me to the world of computers with MS-DOS was including the variable /? in each and every .exe and .com command it found on the system. When you enter this command behind an application, it displays Every options that the application offers you according to the variables that we introduce after its name.
say /?
Using this command, the system will show us all the available options for the command say which displays a list of files.
Function keys are keyboard shortcuts
The function keys at the top of the keyboard, above the number line, are keyboard shortcuts from the command line. Each of the function keys is assigned different functions, although some are similar.
- F1: By pressing this key, the last command we have executed will be displayed again, letter by letter.
- F2: Copies the displayed command up to a specified character.
- F3: Show the entire previous command.
- F4: Clears the displayed command up to a specified character.
- F5: Every time we press F3, the last commands used will be displayed.
- F6: Enter the EOF prompt in CMD.
- F7: Displays a list of previously entered commands.
The use of these keys is especially useful if we take into account that the copy and paste commands, as I have explained above, is not an easy functionality to use on the command line.
Change the title of Command Prompt
When we open CMD, at the top of the window the text is displayed Administrator: Command Prompt either Command Prompt 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 in a faster way. Using the command
title softzone
The window will be renamed from Command Prompt to . This change will be removed once we close the command window.
What drivers do I have installed?
If your computer is having a problem with the drivers and you prefer to find the solution through the command line, you can use this command to show a list with all the drivers installed on your computer.
driverquery /fo list /v
This list shows us the location of the driver on the computer, whether it is running or stopped, the space it occupies on the computer, the date of the file, among others.
Find files sorted by creation date
Before the release of Windows, MS-DOS was a complete operating system with which we could do the same functions as using the graphical interface, but only using commands. In fact, today, we can still find some functions that are only available through CMD, such as the possibility of creating a text file with all the files that are part of a folder, a function that is only available in Windows through third-party applications and that we have explained above how we can do it.
What cannot be denied is that, with the advent of the graphical interface, carrying out certain operations is very more easy, such as displaying files by the date they were created or sorting them by the date they were last modified. This function is also available through command prompt using the command say.
The command say allows us to list files of files, folders and subfolders. But, with the right parameters, we can also filter and sort the information. If we want to show the files that have been created recently or that have been modified on the closest date to which we are, we must use the /od parameter
dir/os
parameter either allows us to filter the files and d Sorts the files from oldest to newest.
See all the information of your equipment on the screen
Sometimes we need to take a look at the entire configuration of the computer and operating system at that moment, all from a command prompt window. It is true that the graphical interface of Windows offers us several functions that offer us detailed information about the computer as such or about the system. Likewise, we can use external applications that help us greatly to obtain data in this regard.
But at the same time we must keep in mind that CMD also offers us a command that we can execute quickly and easily to obtain all this information first hand. that way in screen will appear, in a matter of a few seconds, some important information regarding the hardware of our computer, as well as everything related to the Microsoft operating system. To do this we just have to type the following command in the command prompt window:
systeminfo
Next, we only have to move with the cursors through the list that will appear on the screen in order to consult what interests us in that case. We may be interested in printing or storing all this information since it could be of help to us in the future.
