blog posts

23 best Command Prompt (CMD) commands you should know(2023)

When you want to use text commands in graphical interfaces like Windows, you should use CMD, which actually helps you to run different processes in the operating system.

CMD commands are functional text commands that are used in graphical interfaces. CMD commands allow the execution of various processes in the operating system.

 

 

There are many CMD utility commands. For your convenience, we have brought you some of the most important ones in this article that you can use.

The Windows operating system is popular among users due to its ease of use and lovely graphical environment, and for this reason, it is the choice of many people for the server operating system. If you are one of these people not used to any other operating system than Windows, you can visit our Windows virtual server purchase page and purchase your Windows virtual server if you wish.

 

 

What is CMD?

CMD actually stands for command prompt, which is the same command line and text command that you can execute the commands you want. Different operating systems run CMD in a text-based user interface. You can apply an advanced function that uses all CMD commands to troubleshoot and fix some problems in Windows.

For example, the CMD.EXE command line is a local Windows program whose main task is to interpret and execute all CMD commands. Microsoft has created this program for operating systems based on Windows CE, OS/2, and Windows NT.

The thing you should pay attention to is that CMD should not be confused with DOS. The command prompt is actually a real executable program with a graphical user interface that supports many of the command line capabilities found in MS-DOS.

Command prompt commands are easily executed by the user interface. It allows you to copy files, delete them and even create folders that cannot be deleted. The command line is actually a way that you can communicate with your computer system and tell it your commands and make it work. To put it more simply, the command prompt is actually a computer language.

Where is the command prompt?

No need to look for command prompts in strange places. Press the WIN+R buttons simultaneously and type CMD in the box to access it.

List of CMD utility commands for Windows

Below are some commands from CMD that you can use. We have tried to collect the most valuable orders for you. Do not forget that we are dealing with a powerful tool and it is better to take great care in learning it.

Stay with us to work with CMD.

assoc command to change the format of the executable file

The use of this command is to identify which extension is related to which file. In fact, most files are associated with certain programs and are assigned to open that type of file by default.

CMD

 

You can change the extension of the executed files. For example, you can run this command, and files will not open with their usual extension. For example, image files that are opened in jpeg format, change their design so that they can be opened in another form that you want.

For example, if you want to run a jpeg file with Notepad, use the following command.

assoc .jpg=txtfile

cipher command to recover deleted Windows files

This may be very scary for you if we say that the file you delete in Windows can be recovered. The story goes that when you delete a file, it goes to a space that is inaccessible and will be restored until the system overwrites it with newer data. The cipher command is actually one of these commands; In other words, you can reduce people’s access to your deleted data to zero with the help of this command.

The following code is for erasing the C drive:

cipher /w:C

CMD

driverquery command to view details on installed drivers

This command allows you to see more details about the drivers you have installed in your Windows. The use of this code becomes clear when, for example, your printer driver is not installed on Windows, in this case, the printer is practically useless, so you can use the following command.

driverquery -v

CMD

 

file compare command for writers and programmers

This command is more useful for writers and programmers; Because it allows them to recognize even the smallest difference between two texts.

You can use the FC command using the following pattern:

fc /l “C:\Program Files (x86)\example1.doc” “C:\Program Files (x86)\example2.doc”

CMD

 

ipconfig command to determine ip

You can use this command to determine the IP of your computer. This command also allows you to get the local network address of the router by entering this command if you are connected to a router.

Another popularity of this command is because of its extensions. If you need a new IP, you can first use the command ipconfig /release and then enter ipconfig /renew.

You can use the ipconfig /flushdns command to update and refresh the DNS address.

CMD

 

netstat command to view open ports and ip addresses

Use the netstat –an command to display a list of open ports and associated IP addresses. In addition, it determines the status of the harbor from three modes: listening, established or closed. You might think to yourself that this command is not very useful, but in fact, this command is used when you want to perform troubleshooting or suspect that the system is infected with trojans and want to identify malicious connections.

 

ping command to check the connection of your device and a specific ip

The function of the ping command is that it checks the connection of your device with a specific IP and sends you the test data entered into the IP, and then returns it again. Finally, you will see more details of this connection.

 

 

pathping command to test routers

This CMD is a more advanced command than ping, which tests multiple routers between your computer system and the IP address. However, remember that this command will show you more information about the route and sending data.

The way to write this command is the same as Ping, except that you need to put the desired IP after pathing.

Like this: pathping 172.217.169.238

 

tracert command

This order is one of the most searched orders among other orders. In terms of similarities, the tracert command is similar to the pathping command, which does a good job of tracing. You can write the tracert command and trace the IP address you want.

Finally, you will receive complete information about each step of your computer’s path to the goal. The number of jumps between servers or devices will be shown by this code in milliseconds.

 

powercfg command for system power management

This command is one of the most powerful commands that you can use to manage and track your computer’s energy consumption. In addition, you can use the following commands to manage the hibernate operation:

powercfg hibernate on

powercfg hibernate off

You can use powercfg /a to see different energy-saving modes in your system.

 

shutdown command

Another useful command that we can introduce is the shutdown command. You may think this CMD is pointless. But in fact, you can restart your computer from the command shutdown /r /o and after Windows boots, see the Advanced Start Options menu.

 

systeminfo command to view computer configuration

You can use this command to view your computer’s configuration overview. But what information can you get with the help of this command? Things like:

  • Windows original installation date
  • Last launch time
  • BIOS version
  • The amount of total and available memory
  • Fixed the installation problem
  • Network card configuration
  • And…

diskpart command to format hard drives in several steps

The disk part or format command erases hard drives in several steps. To do this, what you have to do is first write the command disk part and then press enter, and then write list disk and press the enter button again. Select the hard drive that you want to format and then click Clean

tasklist command to view tasks that are hidden in Task Manager

This command almost does the work of Task Manager, except that with the help of this command, you can see the tasks that are hidden in Task Manager.

 

The Chkdsk command scans your hard drive

Another very useful CMD command is the Chkdsk command. What this command does is it scan your entire hard drive and identify and fixes any problems. If you want to scan a hard drive you are suspicious of; you can use this command. Let’s say that your D drive has failed. You can use the command chkdsk D:

 

The NSlookup command fixes DNS problems

NSlookup stands for Name Server Lookup; the purpose of this CMD is to troubleshoot and fix DNS problems. In addition, with the help of this command, you can obtain information related to the domain with the help of the Name Server.

This information is the information related to the ZoneFile of each domain. What this command does for troubleshooting is that it checks all the DNS records on the server, and if there are no records or they are wrong, then it can diagnose the problem. You can use this command in two ways:

Interactive

The interactive command executes many commands, one after the other. To use this command, you must write NSLookup in the CMD environment.

After that, the name and IP address of the DNS server you are using will be shown.

Enter the domain name or IP address in the next line. Of course, in the following line, you can enter another name or IP you want.

Noninteractive

Noninteractive shows information about the domain. To use this command, enter the domain name or IP address after the NSLookup statement.

Note that this mode is the opposite of Interactive way and you should not enter multiple domain names in a row; Rather, you must enter the domain name or IP after the NSLookup statement.

Switch command

Switches are actually extensions that are added to a command and change the behavior of the command. The thing you should keep in mind about this command is that you can add multiple switches to one command, but there must be a space between the command and the switch.

dir command

This command displays the contents of a path. You can use the d/ and w/ switches to show you the contents that have a high number in a column.

CD command

CD stands for Change Directory, and this command is usually used to change the path. But what is meant by changing the path or changing the directory? Many people confuse a directory with a folder, to understand the concept of a directory it is enough to say that a directory is actually a storage path of a file. For example, if you want to enter the desktop path, you must use the cd desktop command. The point that you should pay attention to is that the path you choose must be from the path you are on.

For example, see the following code:

cd Desktop

To determine which path we are in, just enter the dir command we said above without any switches so that you can see all the sub-folders and after you can enter any folder you want.

To be able to return to the previous path or directory, use the CD command.

mkdir command

To remember this command, it is better to know that mkdir

In fact, it is an abbreviation of make directory. In fact, we use this command to create a directory. This command creates a folder for us in the same path as we are. To use this command, use the following code and replace Name with the desired name.

mkdir name

rmdir command

The previous command will help you to create a directory. But this created directory can be deleted with just one command: rmdir.

Rmdir actually stands for Remove Directory, what it does is to delete empty directories, and if there is a file in it, it will not be deleted. The solution to this problem is to use a switch to delete the directory with its contents.

rmdir /s /q name

del command

The previous command that we wrote, even though it deletes the folder and does not affect the file. In order to delete files, you must use the del command. In order to delete the file, you need to enter its extension. For example, imagine that you want to delete a text file. To do this, use the following command:

del filename.txt

systeminfo command

As you can guess from its name, systeminfo

It shows us a vast amount of information. This information includes the following:

  • Amount of RAM used
  • Windows serial number
  • Motherboard model
  • Paging file storage or virtual memory
  • BIOS version
  • time zone
  • network card
  • Installed hotfixes
    And…

Using the following command is enough to access the information we said.

Conclusion

This article has come to an end and we have provided you with all the useful CMDs we thought could exist. Of course, various CMDs bringing them here would only make the article long and may never be of use to you. If you know the CMD application, share it with us in the comments section and if you have any questions, ask us to answer as soon as possible.