14 Command Prompt (CMD) Commands Windows Users Should Know
So you can have more control over your PC
The Command Prompt has been a core part of the Windows operating system for a long time. Some commands are so helpful that they’re faster and more effective than the graphical interface. Here are 21 of the best CMD commands for gaining more control over your PC.
Also, be sure to check out our YouTube video, where we go over the commands listed in this article:
1. ASSOC: Fix File Associations
TheASSOCcommand is one of the most powerful tools in the CMD command library.
Your computer associates file extensions with applications. This is how your computer knows to open Adobe when you double-click a PDF file or Microsoft Word when you double-click a DOCX file.
You can view all the file associations your computer knows about by typingASSOCin the command window. You’ll see the file extension and the program it’s associated with.
You can set the association by typing something likeassoc .doc=Word.Document.8.
2. FC: File Compare
It can be challenging to tell the difference between two similar files. The good news is that there’s a CMD command that lets you compare files and see all differences. The FC command performs either an ASCII or a binary file comparison and lists all the differences it finds.
To compare two ASCII files, use a command like the following:
fc /a File1.txt File2.txt
To make a binary comparison of two image files, use a command like this:
fc /b Picture1.jpg Picture2.jpg
3. IPCONFIG: IP Configuration
Network troubleshootingis never simple, but one command that makes it much easier isIPCONFIG.
Using this command in Command Prompt returns detailed information about your current network adapter connection, including:
You can get even more information by typingipconfig /all.
This information can help you troubleshoot router issues and other connection issues you could be having with your network adapter.
4. NETSTAT: Network Statistics
Concerned that you could have malware running on your computer that’s connecting to internet locations without you knowing about it?
If you run aNETSTATcommand in the command prompt, you can get alist of all active TCP connectionsfrom your computer.
5. PING: Send Test Packets
An IT Analyst’s best friend is thePINGcommand. Running this command sends test packets over the network to the target system.
You can use thePINGcommand to test whether your computer can access another computer, a server, or even a website. It can help with revealing network disconnections. It also provides transit time for the packets in milliseconds, so it can reveals a bad network connection as well.
6. TRACERT: Trace Route
TRACERTis a fascinating Windows Command to use. If you’re ever curious to see the path your internet traffic takes to get from your browser to a remote system like Google servers, you can useTRACERTto see it. Think of it like an advancedPINGcommand that also shows you each step along the route to the target system.
The command stands for “Trace Route,” which sends packets out to a remote destination (server or website), and provides you with all of the following information:
TRACERTcan reveal how the routes of your internet requests change depending on where you’re accessing the web. It also helps troubleshoot a router or switch on a local network that may be problematic.
7. POWERCFG: Power Configuration
Are you frustrated with how quickly your laptop runs out of power? It could be that your power settings are not configured as efficiently as possible. ThePOWERCFG(power configuration) command can help. Run the command prompt as an administrator and typepowercfg – energyto get a full power efficiency report.
The process can take up to about a minute, but when it’s done, you’ll see whether there are any warnings or errors that might help you improve the power efficiency of your system.
View the energy-report.html file to see the details of those errors and warnings.
8. SHUTDOWN: Turn Off a Computer
TheSHUTDOWNcommand lets you shut down a computer and control the behavior of that shutdown. It’s commonly used as a scheduled task or part of an IT batch job after patches have been applied to a computer system.
Typingshutdown /ifrom the command prompt initiates a shutdown but opens a window that gives you the option to restart or perform a full shutdown. If you don’t want the window to open, you can just issue ashutdown /scommand instead.
You can use a long list of other parameters to log off, hibernate, restart, and more. Just typeshutdownwithout any additional parameters to see them all.
9. SYSTEMINFO: System Information
If you need to know your network card brand, processor details, or theexact version of Windowsyou’re running, theSYSTEMINFOcommand can help.
This command polls your system for vital information and presents it in a clean, easy-to-read format.
10. SFC: System File Checker
If you’re concerned that a virus or some other software has corrupted your core system files, there’s a Windows command that can scan those files and ensure their integrity.
You must launch the Command Prompt as administrator (right-click and chooseRun as Administrator). TypingSFC /SCANNOWchecks the integrity of all protected system files. If a problem is found, the files will be repaired with backed-up system files.
You can also use the following switches to alter how the command works:
The scan can take up to 10 or 15 minutes, so give it time.
11. NET USE: Map drives
If you want to map a new drive, you could open File Explorer, right-click on This PC, and go through the Map Network Drive wizard. However, using theNET USEcommand, you can do the same thing with one command string.
For example, if you have a shared folder on a computer on your network called\OTHER-COMPUTERSHARE, you can map this as your own Z: drive by typing the command:
Net use Z: “\OTHER-COMPUTERSHARE” /persistent:yes
Thepersistentswitch tells your computer that you want this drive remapped every time you sign back into your computer.
12. CHKDSK: Check Disk
While the SFC command only checks the integrity of core system files, you can use theCHKDSKcommand to scan an entire drive. Launch Command Prompt as administrator and use a command like the following:
CHKDSK /f C:
That command runs chkdsk on the C: drive and tells it to fix errors that it finds.
This command checks for things like:
The command can fix any disk errors (if possible). When the command is finished, you’ll see the status of the scan and what actions were taken.
13. SCHTASKS: Schedule Tasks
Windows comes with a wizard for creating scheduled tasks. For example, maybe you have a batch file stored on C:temp that you want to run every day at noon.
You’d have to click through the Scheduled Task wizard to configure this. Or you can type a singleSCHTASKScommand to set it up. Here’s an example command:
SCHTASKS /Create /SC HOURLY /MO 12 /TR Example /TN c:tempFile1.bat
The scheduled switch accepts arguments like minute, hourly, daily, and monthly. Then you specify the frequency with the /MO command.
If you typed the command correctly, you’ll see the response,SUCCESS: The scheduled task “Example” has successfully been created.
14. ATTRIB: Change File Attributes
In Windows, you can change file attributes by right-clicking on a file and finding the right property to change. However, instead of hunting around for the file attribute, you can use theATTRIBcommand to set the file attributes.
For example, if you type:ATTRIB +R +H C:tempFile1.bat, it’ll set File1.bat as a hidden, read-only file.
There is no response when it’s successful, so unless you see an error message, the command worked.
Other Windows CMD Commands
As you can see, there are some powerful and useful things you can do with the Windows command prompt, if you know the right commands.
Believe it or not, there are even more commands that will give you the ability to do some things you probably never realized just by typing a simple command.
If you’re interested in learning more, Microsoft offers a full list of all of theWindows CMD commandsincluded in the latest version of Windows.
Ryan has been writing how-to and other technology-based articles online since 2007. He has a BSc degree in Electrical Engineering and he’s worked 13 years in automation engineering, 5 years in IT, and now is an Apps Engineer.Read Ryan’s Full Bio
Welcome to Help Desk Geek- a blog full of tech tips from trusted tech experts. We have thousands of articles and guides to help you troubleshoot any issue. Our articles have been read over 150 million times since we launched in 2008.
HomeAbout UsEditorial StandardsContact UsTerms of Use
Copyright © 2008-2024 Help Desk Geek.com, LLC All Rights Reserved