Top 10 Command Prompt (CMD) Commands You Need to Know

The 10 Best Command Prompt Commands
The 10 Best Command Prompt Commands

A few years back, in the early days of computing, there were no graphical interfaces as we know them and the command line was king. Luckily for us, those days are now over and we can achieve anything we wish through mouse clicking on the GUI.

Most of the options Windows accessible to the user are through different menus. However, it may be interesting to know certain commands allowing quick access to the various parameters of the operating system, in particular via the “ Execute or by throwing them inside a command prompt Windows (CMD).

However, any advanced user wishing to control his computer a little bit and perform certain sometimes complex actions of " debugging » software, custom installations, or even repair of Windows must know and know how to use these few command prompt commands (CMD).

Let's review them together.

1 . ipconfig

Ipconfig is the most used command whenever you want know your IP address locale and the network configuration of our machine.

One of the most used series of commands is the " ipconfig / release " followed by “ipconfig /renew » that you have to type in the command prompt (CMD).

These commands will allow you to force your PC Windows to release the DNS configuration of your network card and renew your local IP address, which is useful when your computer displays a “ limited connection or if you have a problem connecting to the internet.

2.Netstat

Order entry netstat -an will provide you with a list of currently open ports and associated IP addresses. It is useful for knowing the state the listening port is in, which can be in a "listening", "established" or "closed" state.

This command comes in handy if you're trying to troubleshoot devices connected to your PC or when you're concerned that a Trojan or virus has infected your computer and created connections to unknown servers.

There is also a free and specialized linux distribution, called Kali Linux, which you can install in a virtual machine and offers you many commands and applications dedicated to security.

To understand more fully how the TCP/IP layer on which the Internet Protocol is based, you can follow a tutorial on TCP/IP networks which will teach you the essential concepts of how networks and the Internet work.

3.Ping

In the series of network-related CMD command prompt commands, one of the best known and of course the “ping” command.

How do you know if you can successfully reach a website or a certain application? The easiest way is to write in your command prompt " ping funinformatique.com " for example or directly the ip address like this: " ping 74.125.128.101 ».

If you can't get a response like " Response from 74.125.128.101: bytes=32 time=28ms TTL=103 that there is a communication problem.

There are also other settings that you can find by just typing " ping ».

4. Pathing

PathPing is a command very similar to "ping", but this time it allows you to obtain the list of routers between your computer and your target.

It is used by simply typing " pathping google.fr or your IP instead of the domain name “google.fr”.

5.Tracert

Tracert is very similar to "pathping" except that it adds the possibility of obtaining the response times (in milliseconds) that each hop between the routers takes, which can be very useful to see when the connection fails or is slowed down.

6. File Compare (fc)

Wondering how to quickly compare and identify differences between two files? The command fc is the one you need!

Just type fc in your command prompt Windows (CMD) then the directory path and file name of the two files you want to compare.

Example of use :

fc /l “C:\Program Files (x86)\example1.doc” “C:\Program Files (x86)\example2.doc”
  • /l is a parameter to compare only ASCII text.
  • /b will only compare the binary output.
  • /c will not take case into account.

7. Association

On your computer, most files are associated with a specific program that will launch when you click on a file to open it. For example by clicking on “myfile.pdf” you will normally open your PDF file with the viewer Windows or the Adobe Acrobat Reader if you have configured it that way.

The command Assoc will allow you to list all the file associations present on your computer and their default program.

You can extend the command to change file associations. For example, assoc.txt= will change the file association for text files with the program you enter after the equals sign.

However in Windows 10, there is a more user-friendly interface that also allows you to change file type associations with just a few clicks.

For this, go to Settings (Shortcut key Windows + i )> Applications>Default applications>Choose the default application you want to use for a file type.

8. Powercfg

powercfg is a very powerful command to manage and track your computer's power consumption.

Start a command prompt Windows (CMD) in Administrator mode and type “ powercfg / a to bring up the list of different power management modes available on your computer.

You can use the command " powercfg hibernate on » and " powercfg hibernate off to manage hibernation.

Another very useful command is “ powercfg / devicequery s1_supported button, it allows you to display the list of devices on your computer that support connected standby. When enabled, you can use these devices to wake your computer from sleep mode, even remotely.
Knowing the list is therefore useful.

To activate a device afterwards, you can go to " Device Manager ", open its properties, go to the " Power management ", then by checking the box " Allow this device to wake up the computer ».

The command " powercfg / lastwake will show you which device last woke up your pc when it was in sleep state. Useful for troubleshooting your computer if it seems to wake up randomly.

Do you want to know if your computer Windows has energy efficiency issues?

Run the command " powercfg / energy », this will start the analysis of your computer and give you a small report available at the address indicated in the command prompt, as in this screenshot:

9.SystemInfo

In order to know the detailed hardware configuration of your computer as well as software information regarding the version of Windows 10 installed as well as the patches or the configuration of the network cards, then you can use the command “ systeminfo ».

You can even search for information on a computer on your local network with the command:

systeminfo /s [hostname] /u [domain]\[username] /p [password]

10.Cfs

Have you had any problems on your computer lately?
Use the command " sfc in Administrator mode to verify the integrity of files on your system.

The tool will scan all files of Windows in order to spot errors and attempt an automatic repair.

To run it, type “sfc /scannow with administrator privileges.


If the tool finds corrupted files, it will automatically replace them using a copy kept in cache by Windows to this end.

If your computer is not very powerful, running this command will take some time.

Benefit from powerful Linux commands on Windows

As a bonus, did you know that you can get and use Linux commands under Windows 10, such as the command “ find "," grep "," Black "," cat "Or" split »?

For this, there are two methods, one where you can use the WSL2 which will be covered in a future tutorial, and one by installing small binaries, called “ UnxUtils ».

  • Download UnxUtils here.
  • Unzip the .zip file and copy the complete folder in for example " C:\UnxUtils »
  • Type " Environment variables » in search Windows and open the System Environment Variables panel.

  • Add the address (C:\UnxUtils\usr\local\wbin)to the folder UnxUtils in the user environment variables by first clicking on " Path "And then" Edit », Then click on« New ».
  • Save and restart the computer.

You now have access to many linux commands such as " find " or " grep allowing you to perform sorting or other actions on files.