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 plain faster to use than their graphical interfaces.
If you’re into 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.
ipconfig: Quickly Find Your IP Address
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
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
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.
For more information about using these commands—and other great tools for figuring out why your network or Internet connection is giving you problems—check out our introduction to troubleshooting Internet connection problems.
shutdown: Create Shutdown Shortcuts for Windows
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.
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.
sfc /scannow: Scan System Files for Problems
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 the
sfc /scannow command.
telnet: Connect to Telnet Servers
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 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:
Notice that there is no space between the switch (
/w: ) and the drive (
netstat -an: List Network Connections and Ports
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
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
nslookupcommand 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!