You’d think the Command Prompt (formerly known as the DOS prompt) would be long-gone after 30 years of Windows’ graphical interface, but it’s not, and there’s a good reason why. Though many of its duties have been replaced by icons or tiles, there are still things a DOS command does better or faster, as any IT professional already knows.
Most users don’t need to go into the deep weeds with command prompts (check out Microsoft's A-Z reference if you do), but there are a few tasks and tricks that are handy for everyone to know. What are your favorite commands? Tell us at email@example.com and we might add it to this article.
[Have a tech question? Send your query to firstname.lastname@example.org.]
To access the command prompt, right-click the start button in Windows 10 and select Command Prompt. Make sure you have admin rights on the device you’re using to avoid permission issues.
Note that PowerShell may soon replace Command Prompt as the chosen interface for DOS programming in Windows 10, but you can use these codes in either utility (and you should still be able to find Command Prompt with a little extra digging.)
1. Fix a flaky internet connection: ipconfig
I used to be a PC technician, and whenever we experienced flaky web connectivity on a machine the first thing we’d do is reset the connection via the command prompt. The way we did this was by typing ipconfig /release, which releases the connection (so don’t do this if you need to be connected to the internet). Next, just type ipconfig /renew to reconnect to the internet with a new IP address.
Simply typing ipconfig will show you all the details of your internet connection. One of the most useful is your gateway address, which is the IP address of your router. Type that address into a browser window to access your router.
2. Check your connection: ping
We’ve all had that experience of trying to load a certain website and it just won’t connect, and you’re not sure whether it’s the site's fault or your fault. In these situations I try to ping Google, as that tells me whether my internet connection can reach external destinations.
Open the command prompt and type ping www.google.com. This command sends packets of information out, waits for a response, then shows you how long the trip took and whether any packets were lost along the way. If your internet is working fine it’ll reach the destination and respond back with no packet loss, and hopefully in a very short period of time (just a few seconds, typically).
3. Fix corrupted system files: sfc (System File Checker)
The System File Checker finds and fixes corrupted system files. I’ll often advise readers who have difficult-to-diagnose issues to try it, as it’s a useful baseline action to take when your operating system is acting weird.
For example, a reader was recently able to resolve an issue where an icon had disappeared from his taskbar—specifically, the icon for ejecting external drives safely. He fixed it by typing the command sfc /scannow and waiting for it to do its thing, which can take five to ten minutes depending on your system.
4. Examine your system’s energy efficiency in detail: powercfg
One of the command prompt's least-known talents is its ability to analyze all kinds of behavior about your PC, including the way it uses power. Though it may be most useful for laptop users trying to conserve battery, it can also be handy for desktop users looking for system inefficiencies.
Open the command prompt and type powercfg /energy. The operating system will then analyze your system’s power usage for 60 seconds and deliver a detailed report to your System32 folder (it will tell you the file's location).
You can also type powercfg /batteryreport for all the details on your system’s battery, including the battery level at certain intervals of time, along with the amount of time it took to drain recently, which is how we measure battery life in laptops at PCWorld.com. The powercfg command can do much more, but I use these two capabilities most often.