Quick Links

Key Takeaways

  • Command-line tools are still useful, even in a graphical user interface era. They can often perform tasks that don't have graphical equivalents or are faster to run as command-line commands.
  • Some useful command prompt commands include finding your IP address with ipconfig, troubleshooting network connection issues with ping and tracert, scanning system files for problems with sfc /scannow, connecting to telnet servers with the telnet command, and overwriting a directory with the cipher command.

Command-line tools might seem like an archaic relic from the days of CRT screens and computers with no graphical user interfaces (GUIs), but there are plenty of times when they're still useful. Here are some that are worth learning to use.

Why Use Command Prompt (CMD) Commands?

There are some things you can only do from the command line — even in Windows. Some of these tools don't have graphical equivalents, while others are just faster to run as CMD commands use than their GUI equivalents.

If you're prefer using PowerShell over Command Prompt, you should note that all the commands we're covering in this article work just the same in either tool. And obviously, we can't possibly cover all the useful commands that these tools offer. Instead, we'll be focusing on commands that should be useful even if you're not a command-line person. They're also the same in both Windows 10 and Windows 11.

You should also seriously consider using the Windows Terminal now, regardless of whether or not you're using PowerShell or Command Prompt.

ipconfig: Quickly Find Your IP Address

The results of ipconfig /all on our example PC.

You can find your IP address from the Control Panel, but it takes a few clicks to get there. The ipconfig command is a fast way of determining your computer's IP address and other information, such as the address of its default gateway — useful if you want to know the IP address of your router's web interface.

To use the command, just type ipconfig at the Command Prompt. You'll see a list of all the network connections your computer is using. Look under "Wireless LAN adapter" if you're connected to Wi-Fi or "Ethernet adapter" if you're connected to a wired network. For even more details, you can use the ipconfig /all command.

ipconfig /flushdns: Flush Your DNS Resolver Cache

The DNS cache has successfully been flushed.

If you change your DNS server, the effects won't necessarily take place immediately. Windows uses a cache that remembers DNS responses it's received, saving time when you access the same addresses again in the future. To ensure Windows is getting addresses from the new DNS servers instead of using old, cached entries, run the ipconfig /flushdns command after changing your DNS server.

ping and tracert: Troubleshoot Network Connection Issues

Unsuccessfully inging howtogeek.com.

If you're experiencing issues connecting to a website or other network connection issues, Windows and other operating systems have some standard tools you can use to identify problems.

First, there's the ping command. Type ping howtogeek.com (or whatever Internet server you want to test) and Windows will send packets to that address. You can use either a name or the actual IP address. The server at that IP address (in our case, the How-To Geek server) will respond and let you know it's received them. You'll be able to see if any packets didn't make it to the destination — perhaps you're experiencing packet loss — and how long it took to get the response — perhaps the network is saturated and packets are taking a while to reach their destinations.

The tracert command traces the route it takes for a packet to reach a destination and shows you information about each hop along that route. For example, if you run tracert howtogeek.com , you'll see information about each node the packet interacts with on its way to reach our server. If you're having issues connecting to a website, tracert can show you where the problem is occurring.

Tracing the route to the How-To Geek website.

There is a lot more you can do with these commands too, including some pretty helpful troubleshooting options if you're experiencing connection problems.

shutdown: Create Shutdown Shortcuts for Windows

The shutdown command with a 30 second timer.

The shutdown command lets you shut down or restart Windows. Admittedly, it was more useful in Windows 8 (where the shut down button was harder to access), but still handy no matter what version of Windows you use. You can use the command to create your own shortcuts and place them on your Start menu, desktop, or even taskbar.

In Windows 10 and Windows 11, you can even use a special switch to restart your computer into the advanced startup options menu. To use the command at the Command Prompt or when creating a shortcut, just type one of the following:

  • shutdown /s /t 0: Performs a regular shut down.
  • shutdown /r /t 0: Restart the computer.
  • shutdown /r /o: Restarts the computer into advanced options.

If you adjust the number after /t you can set the amount of time until your PC restarts (in seconds). If you want to cancel a scheduled shutdown, just enter:

shutdown -a 

sfc /scannow: Scan System Files for Problems

The results of sfc /scannow on our example PC. It returned some problems, but SFC repaired them.

Windows includes a system file checker tool that scans all the Windows system files and looks for problems. If system files are missing or corrupted, the system file checker will repair them. This may fix problems with some Windows systems.

To use this tool, open a Command Prompt window as Administrator and run:

        sfc /scannow
    

telnet: Connect to Telnet Servers

The "Windows Feature" window imposed over the Control Panel. The "Telnet Client" option is highlighted.

The telnet client isn't installed by default. Instead, it's one of the optional Windows features that you can install through the Control Panel. Once installed, you can use the telnet command to connect to telnet servers without installing any third-party software.

You should avoid using telnet if you can help it, but if you're connected directly to a device and it requires that you use telnet to set something up — well, that's what you have to do.

cipher: Permanently Delete and Overwrite a Directory

Cipher being used to wipe the C:\ drive. We did not execute the command.

The cipher command is mostly used for managing encryption, but it also has an option that will write garbage data to a drive, clearing its free space and ensuring no deleted file can be recovered. Deleted files normally stick around on disk unless you're using a solid state drive. The cipher command effectively allows you to "wipe" a drive without installing any third-party tools.

To use the command, specify the drive you want to wipe like so:

cipher /w:C:\

Notice that there is no space between the switch ( /w: ) and the drive ( C:\ )

netstat -an: List Network Connections and Ports

The results of netstat -an in the Terminal.

The netstat command is particularly useful, displaying all sorts of network statistics when used with its various options. One of the most interesting variants of netstat is netstat -an , which will display a list of all open network connections on their computer, along with the port they're using and the foreign IP address they're connected to.

nslookup: Find the IP Address Associated With a Domain

Running nslookup on howtogeek.com

When you type a domain name (say, into a browser address bar), your computer looks up the IP address associated with that domain name. You can use the nslookup command to find that information out for yourself. For example, you could type nslookup howtogeek.com at the Command Prompt to quickly find out our server's assigned IP address.

You can also perform a reverse lookup by typing an IP address to find out the associated domain name.


This isn't a comprehensive list of all the commands you might find useful, but we hope it's given you some idea of the many powerful tools lurking under the surface. Have your own favorites we didn't mention? Join in the discussion and let us know!