Basic cmd commands every windows user should know

The graphical user interface that the Windows operating system currently presents to us is suitable for all types of users. It has been designed to facilitate work for both the more advanced and beginners in front of a PC. But we can always use the command line or CMD if we wish and do without it.

We must bear in mind that on a day-to-day basis with the computer we find ourselves with a complete and complex operating system. This has not stopped growing over the years and its new versions, but of course, Microsoft itself tries to make things much easier for us. For this, as we mentioned, it also improves the graphical user interface so that the system can use it and configure it without problems almost everyone.

But of course, as is usual in most areas related to software, some more advanced always require more control. Of course, Microsoft could not be left behind in this sense, for what the command line offers us. We can access this through the command line also known as CMD, or from Windows PowerShell.

What is the command line or CMD

For those of you who do not know what we are talking about in these lines, it should be clear that this is not about anything else but a command line from which we can carry out multiple tasks based on written commands. These are generally executed internally and automatically when performing all kinds of actions in the aforementioned graphical interface. However, from the CMD more advanced users will have much more control over all this.

As a curiosity we will tell you that the CMD we refer to is the abbreviation of CoMmanD and it is a Microsoft program that comes from the mythical This is the MSDOS shell that has been around for decades, in a more or less visible way. In the early days of Microsoft’s operating system, everything worked based on commands like the ones we are going to show you in these lines. But with the passage of time this has been falling into disuse passing to the more comfortable and visual graphical interfaces.

In this way, from this section we will be able to carry out a multitude of tasks in the system, all this by typing direct commands to it.

How to open the Windows CMD

Therefore, for those of you who are interested in discovering this section of the Redmond operating system , we will tell you how to run it. First of all you have to know that it is part of Windows itself, we just have to start it. For this we must go to the search box of the Start menu, for example, and write CMD.

At this point it is worth mentioning that it is advisable in this case to run all this with administrator permissions. Thus we can carry out more complex tasks with greater control over the operating system. Therefore, once the icon with the executable is located, we click with the right mouse button on it to be able to execute with administrator permissions .

Advantages of running CMD with administrator permissions

Something that we must bear in mind once we have reached this point, is the way in which we execute this Windows functionality. And it is that as it happens with the rest of applications that we have installed in the PC, the CMD can be executed in different ways. In just we open the file in a conventional way, we access the command prompt window with certain permissions blocked. This can be very useful so that we cannot make dangerous changes that could even damage Windows itself.

But on the other hand, if we are users with some experience in the Redmond system, and we also know the power that CMD offers us, we should run it with administrator permissions . That, as you can imagine, gives us access to more advanced functions of Windows itself. These as a general rule will refer to more intense and therefore delicate changes that will allow us to fully adapt the operating system itself, all based on advanced commands. But as we mentioned before, for this it is preferable that we know very well what we are doing so as not to corrupt the software.

What is PowerShell and how does it differ from CMD

As we told you, the CMD or command symbol has been with us for many years, since the beginning of the Microsoft operating system. Initially the original MSDOS Shell and the default in Windows 10 was the same for a long time and was the system default option. But after the appearance of PowerShell, this changed a bit, as this improved version for executing commands went a bit further.

And it is necessary to bear in mind that Windows PowerShell allows us to carry out more complete and complex developments, jobs and executions, all based on commands. This element is an advanced scripting language written in the Microsoft .NET Framework that enables you to perform background tasks or automate tasks. Therefore, it could be said that it is an improved and more modern version of the mentioned CMD. Thus, to open it, as in the previous case, we write its name in the search box and we also execute with administrator permissions.

The most important basic commands of the CMD

Once we know all this, we are going to show you a series of basic commands that you can use in the aforementioned CMD. Getting to know everything that surrounds the command prompt is nothing more than acquiring some experience in using the commands that we are going to need the most.

As we get used to all this, we can go deeper with parameters that allow us to squeeze them a little more. Of course, something that we must bear in mind is that these parameters that we are talking about, you can see them by writing Help followed by the command from which we want to see those parameters.

Commands for working with files

These are CMD commands that focus on working and dealing with the files that we have stored on disk drives in many ways and in depth.

  • ATTRIB: allows us to see in addition to modifying the attributes of any file on the computer in order to expand its usability. We can indicate it as read- only , for total control, just write, etc.
  • COMP – Compare the contents of two files or a set of files directly.
  • COMPACT: allows us to see in addition to modifying the compression status of the files indicated in the command, all valid on NTFS partitions.
  • COPY: lets us copy one or more files to another location on the hard drive.
  • DEL: deletes one or a set of specified files from those saved on the device.
  • ERASE: command to erase one or a group of files that we previously indicate.
  • FC: allows us to compare two or more files and also offers us as output the
  • differences between all specified.
  • FIND: to search for a text string in one or more files that we indicate in the same command.
  • FSUTIL FILE CREATENEW: allows us to create any type of file, and specify the size we want it to be.
  • FTYPE: shows on the screen the file types used in the extensions that we indicate. It also allows us to modify those associated types
  • MOVE: to move one or a group of files from one directory to another or in the location that we indicate.
  • RENAME: command to rename one or a group of files.
  • REPLACE: to replace files.
  • ROBOCOPY: tool for efficient file copying.
  • TYPE: allows you to view the content of any file from CMD.

Commands for working with directories

Here we are going to find a series of commands that allow us to manually manage the directories saved on the disk drives

  • CD: allows us to move between the system folders by typing the command and the destination path. It also shows the name of the current directory on its own. If we write the unit as is, followed by a colon (for example, d 🙂 we will change to that unit.
  • CHDIR: lets us see the name of the current directory or changes to another, very similar to CD.
  • COPY: command that allows us to copy files from one directory to another.
  • DIR: shows a list of all the files and subdirectories in which they are located in the current directory or in any other that we indicate.
  • MD: create a new folder in the current directory.
  • MKDIR: to create a new directory.
  • MOVE: allows us to move a directory to another site. It would be the equivalent of “cut.”
  • REN: allows you to rename files and folders.
  • RD: to delete a directory.
  • TREE: allows us to view the directory structure of a complete disk unit in a tree form, or of a directory that we specify
  • XCOPY: allows copying both independent files and entire directory structures.

Network commands

If you want to know all the details of your Internet connection or the local network, these commands cannot be missing to execute from the CMD.

  • GETMAC: allows us to know the MAC address of our computer.
  • IPCONFIG: allows us to view all the information on the network cards of the equipment in detail.
  • PING: this is a command that allows us to easily check the status of our connection. In the case of detecting problems, it serves to identify their cause.
  • TRACERT: establishes a route from the local computer to the destination server and shows all the jumps that the connection makes until it reaches the end point and see where there may be connection errors in particular.
  • NETSAT: allows us to control, analyze and diagnose a network from the CMD, it also allows us to know the connections that are open on the PC, both local and remote.
  • NSLOOKUP: allows you to know if the DNS server that we have configured by default is correctly translating the URLs to the corresponding IP addresses.
  • NBTSTAT: to see the statistics of the TCP / IP protocol and the current connections established in the equipment.

System commands

In this section we find a list of CMD commands to manage some very important parts regarding the operation and behavior of the operating system itself.

  • CHKDSK: powerful command for disk drives that checks their integrity and provides a report on the status of each one.
  • CHKNTFS: allows us to see in addition to modifying the disk check when starting the operating system.
  • CLEANMGR: allows you to clean the hard drives of unnecessary files.
  • CLS: clears the active screen completely.
  • CMD: starts a new command prompt window like the one we have running at the moment.
  • COLOR: allows us to change the foreground and background colors to work here in the best way, on the command line.
  • CONTROL PANEL: when executed, it allows us to open a Windows Control Panel window.
  • CONVERT: converts FAT-formatted disk drives to NTFS volumes except for the current one, that is, applicable to the rest of the disks on the computer.
  • DATE: lets us view or sets the current date of the operating system and the PC.
  • DEFRAG: defragments the hard drive.
  • DISKPART: teaches us and allows us to configure the properties of the partition of the disk in which we are at the moment.
  • DISM: command to analyze the system and perform basic maintenance.
  • DRIVERQUERY: allows us to see the current status and properties of the computer’s drivers on the screen.
  • EXIT: it helps us to close the current session of the command line.
  • FORMAT: used for the purpose of formatting an entire hard drive.
  • FSUTIL: allows us to view or configure the properties of the disk drive’s file system.
  • HELP: presents additional information and parameters for the indicated commands on the screen .
  • LABEL – Create, change, or delete the volume label for a disk drive.
  • LOGOFF: allows you to log out of the PC.
  • NET USER: allows us to create a new user in Windows from commands.
  • POWERCFG: allows us to see a detailed report on the energy consumption of our computer.
  • PRINT: command to print text files.
  • RECOVER – Attempts to recover information from a disk drive that has become damaged or defective for some reason.
  • SFC: allows us to analyze Windows to find, and repair, possible faulty files.
  • SHUTDOWN: allows us to perform both a local and remote shutdown of the computer.
  • SYSTEMINFO: shows us on the screen all the properties and configurations of the equipment.
  • TASKKILL: allows to finish any process by its ID.
  • TASKLIST: shows a complete list with all the processes that are running.
  • TIME: we can see or modify the operating system time.
  • TYPE: to view the content of a text file.
  • SEE: it shows us the version of Windows with which we work.
  • WINSAT: perform a complete benchmark of the PC
  • / ?: is not a command as such, but rather a parameter that we can add to any command. This will allow us to know the correct syntax of any command and see the help for it.

Other tricks for CMD

The above commands are fine, in theory. But what can we use them for? We are going to see some practical examples of commands that can help us make our day to day much more bearable.

Change DNS

The first thing we will have to do to be able to  change the DNS from CMD is to know the name of our network. We can easily do this by executing the following command:

netsh interface show interface

Once we know the name of the network, we can use the following command that will allow us to very easily change the DNS server of our computer from CMD (changing network_name by the name that we have known in the previous point0r, and IP_DNS by the IP of the Primary DNS we want to use):

netsh interface ipv4 set dnsservers "Nombre_red" static IP_DNS primary

To add a secondary DNS, we will simply execute the following command with the same changes:

netsh interface ipv4 add dnsservers "Nombre_red" IP_DNS index=2

Clever. Our computer will begin to use the new DNS. And, if we want, we can easily create a script (in bat) to change them at another time.

Keyboard shortcuts

In addition, it is possible to know several CMD keyboard shortcuts that will allow us to move much more comfortably and quickly through the interface.

  • Right mouse click: paste clipboard.
  • Control + C: Forcibly cancel the running task.
  • Escape: allows us to erase what we have written before executing it.
  • Up or down arrow: allows us to scroll through the most recent commands executed.
  • F1: rewrite the last command executed, writing it character by character.
  • F3: write the last command executed, all at once.
  • F7: shows a history of executed commands.
  • F11: enable or disable full screen.
  • Enter: run the command.
  • Select + Enter: copy the selection to the clipboard.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button