The Windows command prompt is a feature that’s been a corepart of the Windows operating system for a long time. There are some CMDcommands that are so useful and easy to use that even regular users see theWindows command prompt as a key part of the operating system.
There are always rumors that it will be phased out at somepoint, but that’s unlikely to happen any time soon.
The following are 21 of the best CMD commands you shouldknow if you want to have more control over your Windows PC.
One of the most powerful tools in the CMD command library isthe ASSOC command.
Your computer associates certain file extensions withcertain programs. This is how your computer knows to open Adobe when you doubleclick a PDF file, or Microsoft Word when you double click a DOC file.
You can view all the file associations your computer knowsabout by typing ASSOC in the commandwindow. You’ll see the file extension and the program it’s associated with.
You can set the association by typing something like assoc .doc=Word.Document.8.
Sometimes when files are changed over time, it’s hard toremember what the differences were between versions. You may not know that aCMD command offers the ability to compare files and see all differences, butit’s true.
The FC commandperforms either an ascii or a binary file comparison and will list all of thedifferences that it finds.
Fc /a File1.txtFile2.txt will compare two ascii files.
Fc /b Picture1.jpgPicture2.jpg will do a binary compare on two images.
Network troubleshooting is never simple, but one commandthat makes it much easier is IPCONFIG.
Using this command in the CMD command prompt returns detailedinformation about your current network adapter connection including:
This information can help you troubleshoot router issues andother connection issues you could be having with your network adapter.
Concerned that you could have malware running on yourcomputer that’s connecting to internet locations without you knowing about it?
If you run a NETSTATcommand in the command prompt, you can get a list of all active TCP connectionsfrom your computer.
An IT Analyst’s best friend is the PING command. Running thiscommand sends test packets over the network to the target system.
You can use the PING command to test whether your computercan access another computer, a server, or even a website. It can help withrevealing network disconnections. It also provides transit time for the packetsin milliseconds, so it also reveals a bad network connection as well.
TRACERT is afascinating Windows Command to use. If you’re ever curious to see the path yourinternet traffic takes to get from your browser to a remote system like Googleservers, you can use TRACERT to see it.
The command stands for “Trace Route”, which sends packetsout to a remote destination (server or website), and provides you with all ofthe following information:
TRACERT can reveal how the routes of your internet requestschange depending where you’re accessing the web. It also helps withtroubleshooting a router or switch on a local network that may be problematic.
Are you frustrated with how quickly your laptop seems to runout of power? It could be that your power settings are configured asefficiently as possible. There’s a windows CMD command called POWERCFG (power configuration) that canhelp. Run the command prompt as an administrator and type powercfg – energy to 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 improvethe power efficiency of your system.
View the energy-report.html file to see the details of thoseerrors and warnings.
The SHUTDOWNcommand is a pretty versatile command that lets you shutdown the computer butcontrol the behavior of that shutdown. It’s commonly used as a scheduled taskor part of an IT batch job after patches have been applied to a computersystem.
Typing shutdown /ifrom the command prompt will initiate a shutdown, but it’ll upon a GUI to givethe user an option on whether to restart or do a full shutdown. If you don’twant to have any GUI pop up, you can just issue a shutdown /s command.
There is a long list of other parameters you can use to do alog off, hibernate, restart, and more. Just type shutdown without any arguments to see them all.
If you need to know what brand of network card you have,processor details, or the exact version of your Windows OS, the SYSTEMINFO command can help.
This command polls your system and pulls the most importantinformation about your system. It lists the information in a clean formatthat’s easy to read.
If you’re ever concerned that a virus or some other softwaremight have corrupted your core system files, there’s a Windows command that canscan those files and ensure their integrity.
You need to launch CMD as administrator (right click andchoose Run as Administrator). TypingSFC /SCANNOW will check the integrity of all protected system files. If aproblem is found, the files will be repaired with backed-up system files.
The SFC command also lets you:
The scan can take up to 10 or 15 minutes, so give it time.
If you want to map a new drive, you could always open FileExplorer, right click on This PC, and go through the Map Network Drive wizard.However, using the NET USE command,you can do the same thing with one command string.
For example, if you have a share folder on a computer onyour network called \\OTHER-COMPUTER\SHARE\ , you canmap this as your own Z: drive by typing the command:
Net use Z: “ \\OTHER-COMPUTER\SHARE ”/persistent:yes
The persistentswitch tells your computer that you want this drive remapped every time you logback into your computer.
While the SFC command only checks the integrity of coresystem files, you can use the CHKDSKcommand to scan an entire drive.
The command to check the C: drive and repair any problems,launch the command window as an administrator and type CHKDSK /f C:.
This command checks for things like:
The command can fix any disk errors (if possible). When thecommand is finished, you’ll see a status of the scan and what actions weretaken.
Windows comes with a wizard for creating scheduled tasks.For example, maybe you have a BAT file stored on C:\temp that you want to runevery day at noon.
You’d have to click through the Scheduled Task wizard toconfigure this. Or you can type a single SCHTASKScommand to set it up.
SCHTASKS /Create /SCHOURLY /MO 12 /TR Example /TN c:\temp\File1.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.
In Windows, you can change file attributes by right clickingon a file and finding the right property to change. However, instead of huntingaround for the file attribute, you can use the ATTRIB command to set the file attributes.
For example, if you type: ATTRIB +R +H C:\temp\File1.bat, it’ll set File1.bat as a hidden,read-only file.
There is no response when it’s successful, so unless you seean error message, the command worked.
As you can see, there are some powerful and useful thingsyou can do with the Windows command prompt, if you know the right commands.
Believe it or not, there are even more commands that willgive you the ability to do some things you probably never realized just bytyping a simple command.
If you’re interested in learning more, Microsoft offers a full list of all of the Windows CMD commands included in the latest version of the Windows OS.