The most important CMD console commands you should know The most important CMD console commands you should know

Even though there are many who don't know about it, and even more who don't actually use it, the command-line console embedded in every Windows version (since Windows NT) is one of the most useful tools that your operating system provides. Known as CMD, or Command Prompt, this command-line interpreter is analog to UNIX shells and allows you to input a set of commands which you can't issue from anywhere else. To launch this console, all you have to do is press Win and R buttons on your keyboard, type "cmd" (without the quotes) and then press Enter.

Here is a list with some of the Command Prompt commands which I found to be either highly useful or very interesting. There's also a third category called "Redundant" which contains console commands that have easier alternatives, but are still worth mentioning.

Very Useful

Ping

PingPing

Out of all the available commands, Ping is the one I use the most. This instruction allows you to send a data package to a specified URL or IP address and check how long it takes for it to return to your PC. In simpler terms, this command will help you find out if you have a working connection with a website or another computer on your network and also find out how well that connection is working. Here are two examples of how to use it: "ping 196.168.1.1" (for an IP address) or "ping -t www.google.com" (for a website; -t means that this command will not stop automatically and will require you to manually turn it off).

Additionally there are two more closely related commands which could help you out in case something seems to be wrong. If a ping doesn't return and you want to figure out what is the problem, you can find out where it stops by using the Pathping. This command will show you every hop through which the packet is bounced until it reaches its final destination, thus enabling you to see exactly where the connection breaks. (Example: "pathping www.google.com".) In case you want to find out which of the hops is particularly slow you can use Tracert. This command works the same as Pathping, but also displays the time it takes for the package to arrive to each of the hops on the way. (Example: "tracert www.yahoo.com".)

Ipconfig

IpconfigIpconfig

Ipconfig is a command you will often use to quickly get information related to your network / internet connection and the hardware which makes it possible. If you type ipconfig /all into the console and press Enter, you will see a comprehensive list of data including your MAC address, your IP address, the server's IP address, the DNS server address, the Subnet mask, etc. Furthermore, in case if you get a warning message saying that there's an IP conflict on the network, you can type ipconfig /release (then press Enter) followed by ipconfig /renew to force the operating system to give you a new IP address. Lastly, you can use ipconfig /flushdns to refresh the DNS address, but you will rarely need this.

Interesting

Cipher

CipherCipher

If you didn't already know, when you ask Windows to delete a file or a folder, the operating system doesn't actually erase the data but instead marks it as inaccessible, and the space it occupies will be seen as free. However, until the respective disk sector (where the file is) gets overwritten, the data is still recoverable. Cipher is a really cool command which instructs your PC to overwrite all the deleted files from a specified location (drive or folder), thus making them harder to retrieve. Here's an example of how to use it: "cipher /w:c" (this will overwrite all the deleted files from your C partition). And you don't need to worry, this command only overwrites the files marked as deleted, leaving all the other files on your PC just as they are.

Netstat

NetstatNetstat

In case if you suspect you've been infected with some kind of Trojan, or if you think that someone else is also connected to your PC you can check things out by using Netstat. This command displays your current IP along with a list of all your opened ports and related IP addresses, Moreover, the console will tell you if each of the listed ports are listening, established or closed. (This time we don't need an example; simply type the command into the Command Prompt window and press Enter.)

System File Checker

SfcSfc

To be totally honest, I've never actually tested this command, as I reinstall my operating system quite often, but this doesn't mean that you may not need it. System File Checker (sfc) is a command which instructs your Windows to check and repair the system files. In order to use this instruction you will need to give the Command Prompt console administrator privileges, but the function is quite useful, as it attempts to automatically replace missing system files and repair those that are corrupted. To use this command type "sfc /scannow" into the CMD console and press Enter.

Assoc

AssocAssoc

Assoc is a very simple yet handy command which gives you detailed information about all the current associations between file types and the applications on your PC. In simple terms, you can easily find out which application is set to automatically open each extension using this instruction. If you type "assoc" into the console and then press Enter, you will see a list with every extension along with the program designated to deal with it, while if you type "assoc .doc=" you will see which of your applications opens your .DOC documents. (The second example works with any of the extensions you saw in the complete list.)

Powercfg

PowercfgPowercfg

In case if you didn't figure it from its name, Powercfg is a command which gives you information and helps you manage your computer's power-related settings. For example, typing "powercfg /a" in the CMD console and pressing Enter will display all the power-saving options that are currently available to you. As I said, you can also manage these setting: "powercfg /sleep off" will disable the sleep command for your PC. Additionally you can use "powercfg /devicequery s1_supported", which will display a list with all the devices on your network that support connected standby (meaning that they can remotely put your computer to sleep or wake it). Lastly, "powercfg /lastwake" will show you which connected device woke up your PC the most recently.

Redundant

Shutdown

ShutdownShutdown

In Windows 8 and Windows 8.1, the Command Prompt console can also be used to shut down your PC. I know that there are easier ways to do this, but if your type "shutdown" into the console your computer will be shutdown. However, when used with additional parameters, this command can actually be useful. For example, typing "shutdown /r /o" and pressing Enter will instruct your PC to restart and automatically open the Advanced Options Start Menu on startup (it's the place where you can choose to start your Windows in Safe Mode).

Tasklist

TasklistTasklist

Last on our list is the Tasklist command, which acts pretty much just like the task manager, displaying all the processes that are currently running on your Windows. (Just type "tasklist" in the console and press Enter.) The list contains the name, PID, Session Name, Session Number and Memory Usage of each entry on the list. If you were wondering why the PID is useful, I'll tell you. You can type "taskkill -PID <ID number>" and terminate the respective process. (For example, if you take a look at the image to the right, if I typed killtask -PID 508 the console would terminate the Winlogon process.

G
Guest
Thank you so much. Really helpful and informative article.

Was it helpful?  yes(1) no(0) | Reply

Referenced Windows applications

PowerCmd
rating

PowerCmd is a graphical interface for Windows command prompt.

Author's other posts

How to make your Mac kid-friendly?
Article
How to make your Mac kid-friendly?
A few tips on how to ensure your kids' safety while they're using Macs as well as on how to keep the machine safe from your children.
Samsung's next Galaxy phone is already up for reservations
News
Samsung's next Galaxy phone is already up for reservations
Even though Samsung hasn't announced the price of the upcoming Galaxy phone or its technical specifications, we can already make reservations and be among the first to receive it.
Find out which Android phones will be able to run Fortnite
News
Find out which Android phones will be able to run Fortnite
Curious to see if you'll be able to play the Android version of Fortnite on your phone? Here's the complete list of supported devices.
Mac security tricks
Article
Mac security tricks
If you don't have a lot of experience in using your Mac, here are a few tips that could keep your machine safe from various threats.