20 Windows Command Prompt (CMD) Commands You Must Know
The command prompt remains an effective Windows tool. Here are the most important CMD commands that every Windows user should be aware of.
This article will provide the key commands that every Windows user needs to be aware of.
Unsure of how to enter how to access the Windows command line, forgot basic Windows Run commands or would you like to be able to see the list of commands for each operation (aka prompt code)? Take a look at our beginner’s guide on using the Windows commands for directions.
Windows Command Prompt Commands
If you’ve never poked around within Windows Command Line and aren’t using it, you’re missing out. There are a lot of useful applications you can make use of when you know the right items to enter.
1. Assoc
The majority of files on Windows are linked to an application that is designated for opening the file as a default. Sometimes the process of remembering these associations could get difficult. It is possible to remind yourself to use assoc. assoc to show a complete set of extension names for files, as well as association with programs.
You may also use the command to alter the file association. For instance, assoc .txt= will alter the association of text files to the program you type following the equal symbol. The command to command will display both the extension names as well as the names of the programs which will allow you to make the most of this command.
With Windows 10, you can navigate through a more intuitive interface, which allows you to change the association of file types immediately. Navigate into settings (Windows + I) > Apps > Default applications > Select the default app based on the type of file.
2. Cipher
The deletion of files on an electronic hard drive won’t erase them. Instead, it marks them as inaccessible and also marks the space they occupied as free. They are recoverable until the system replaces them with new data which could take a long time.
The cipher command, however, allows you to wipe a directory off an NTFS-formatted drive using writing random information onto it. For wiping your C disk, as an instance, you’d need to make use of the cipher /w/d command to wipe out the available storage space from the disk. This command doesn’t overwrite un-wiped data, therefore you won’t erase the data you require when you execute this command.
When you execute the cipher command in its entirety it will return the encryption status of the current directory as well as the files in it. Utilize cipher /e to secure the files, cipher /c: to find details on encrypted files, and cipher /d for decrypting the chosen file. A majority of these commands work when using the Windows security tool, BitLocker.
3. File Compare
This command can be used to detect variations in the texts between files. This is particularly helpful for programmers and writers trying to discover small differences in two different versions of the same file. Just use “FC” followed by the directories path and the file names of both files you wish to compare.
It is possible to expand the function in various ways. The command/b will only compare the binary output. the /c disregards the type of text used in the comparison while the /l command will only be able to compare ASCII text.
As an example you could make use of these examples:
The command above is a comparison of ASCII text from two Word documents.
4. Ipconfig
This command will relay the IP address of the system currently running. However, if your computer is in the vicinity of a router (like the majority of computers in use are today) it will instead relay the local IP address of the router.
It is still effective due to its extensions. Ipconfig release then the ipconfig command renewal will force you to force your Windows PC into asking for a new IP address that is helpful if your computer says that one isn’t accessible. It is also possible to use ipconfig/flushdns to update your DNS server. These commands are useful when the Windows troubleshooter for your network fails, which can occur occasionally.
5. Netstat
The option netstat will show you the list of open ports along with their associated IP addresses. The command will also inform you of the state that the port is in: either established, listening, or closed.
This is a fantastic option when you’re trying to diagnose problems with devices that are connected to your computer, or if you’re worried about a Trojan infecting your system and you’re trying to identify the source of the infection.
6. Ping
Sometimes, you must determine whether or not the packets are getting to an individual networked device. This is the reason ping can be useful.
A simple “ping,” followed by an IP address will transmit a string of test packets to the given address. If they are received and returned, you can be sure that the device can communicate with your computer. If it fails, you’ll be aware of a problem that is preventing the communication between your device and your PC. This could help you decide whether the source of the problem is an inadvertent configuration or a malfunction of the network hardware.
7. PathPing
This is a much more sophisticated version of ping that can be beneficial if you have multiple routers that connect your computer to the device that you’re trying to test. As with ping, you execute this command by entering pathping followed by your IP address. However, unlike ping, it also communicates information regarding the path the test packets travel.
8. Tracert
It is similar to pathping. The tracert command is similar to the pathping command. Again, enter the track with the address of the computer or the address you want to track. You’ll get information on each step of the process between your PC and your desired destination. Contrary to pathping tracers will also track how long (in milliseconds) every transfer between servers or devices is.
9. Powercfg
Powercfg is an extremely effective command to manage and track the way your computer is using energy. You can make use of the command powercfg hibernate to or powercfg hibernate of to control hibernation as well as the powercfg command powercfg/a to display the current power-saving state on your computer.
Another helpful command can be powercfg /device query support which shows the list of devices in your computer that can be connected standby. If enabled, you can utilize these devices to take your computer back from standby even remotely.
This can be enabled by selecting your device from Device Manager and then opening its properties, moving into the Power Management tab, and then selecting the box to Allow this device to wake up the PC box.
The Powercfg command /last wake will display which device was the last to wake your computer from a sleep state. This command can be used to diagnose your PC’s issue if it wakes up from sleep in a random manner.
It is possible to use the powercfg energy command to generate an extensive report on power consumption on your computer. The report will be saved in the directory specified following the command’s completion.
This report will inform you of any system issues that could increase the energy consumption, for instance, devices that prevent specific sleep modes or that are not configured properly to react to the power management settings.
Windows 8 added powercfg /battery report that provides an in-depth review of battery usage as well as any relevant. When it is output to the Windows users directory. The report gives information on the duration and duration of charge and discharge cycles, average battery life, and the estimated battery capacity.
10. Shutdown
Windows 8 introduced the shutdown command, which, as you can guess you did, closes your PC.
It’s redundant with the accessible shutdown button, however, what’s not redundant is this shutdown /r or /o command, which reboots your PC and activates the Advanced Start Options menu, from which you’ll find Safe Mode and Windows recovery tools. This is helpful when you need to reboot your computer to help troubleshoot your computer.
11. System File Checker
The System File Checker is an automatic repair and scan tool that concentrates upon Windows System Files.
It is necessary to start the command prompt using administrator rights. Then, use the command SFC /scannow. If SFC detects any corrupt and/or missing files, it’ll replace them with cached copies created by Windows to serve this purpose. This command may take about half an hour to run on older notebooks.
12. Tasklist
The tasklist command shows the most current information about every task that is currently running on your computer. Although it is somewhat similar to Task Manager this command could occasionally uncover tasks that are not visible to the view of that application.
There’s also a variety of modifiers. Tasklist-svc lists services that are associated with every task. Use tasklist with v to get more information about each task. tasklist with -m will search for DLL files that are associated with the active task. These commands can be useful for troubleshooting more advanced problems.
Our reader Eric mentioned that you could “get an executable’s name that is associated with the specific process ID you’re looking for.” The command to execute that operation can be tasklist | search [process ID[process ID].
13. Taskkill
Tasks listed within the tasklist command will be associated with an executable and a process ID (a five- or four-digit number) that is associated with the task. It is possible to force the stop of the program with taskkill.com –which is followed by name of the executable, as well as taskkill with a PID and then the Process ID. This is, in fact, somewhat redundant with Task Manager however, you can make use of it to end not responsive or obscure programs.
14. Chkdsk
Windows automatically assigns your drive to an examination of the diagnostic chkdsk when the symptoms suggest that your local drive may have poor sectors, lost clusters, and other physical or logical errors.
If you think the hard drive might be failing, you can start the process of a scan. The most simple option is the chkdsk command c: that will instantly examine the C drive without having to restart your computer. If you include parameters such as /f,/r, /x, or /b, as the command chkdsk /f/r/x or /bc, chkdsk can also correct problems, recover data, unmount the drive, and clear any bad sector entries according to. These actions require a restart to be able to be executed with Windows-powered down.
If you observe the chkdsk start-up allow it to do what it does. If it becomes stuck, you can consult our troubleshooting guide for chkdsk.
15. schtasks
schtasks is your command prompt for accessing the Task Scheduler, one of many overlooked Windows administration tools. While you can utilize it as a GUI for managing your tasks the command prompt allows you to paste complex commands into the command prompt to schedule similar tasks, without having to navigate through a variety of options. It’s also much simpler to use once you’ve committed important elements to memory.
For instance, you could set your computer up to reboot at 11 pm every Friday
To go along with your regular reboot, you could plan tasks to start specific applications at the start of each day:
To duplicate the command above to different programs, simply copy the command, copy it, and then edit it according to your needs.
16. Format
If you’re required to format your drive then you could utilize to use the Windows File Explorer GUI or you can go to the Command Prompt. You’ll require administrator rights to access this command. Make sure that you specify the volume you would like to format, and then the parameters you wish to format.
The following command will quickly format the D drive using the exFAT system of file systems and an allocation that has a size of 2048 bytes and change the name of the volume to “label” (without any quotes).
It’s also possible to utilize this command to demount an entire volume (/X) or when it’s formatted using NTFS, you can make file compression the default option (/R). When you’re stumped, try the format command or /? to call for assistance.
17. prompt
Do you want to modify your command prompt to contain specific instructions or details? By using the prompt you can!
You can include the current date, time as well as the drive and path Windows Version number, and much more.
Enter “prompt” to restore your command prompt to its default settings, or simply reboot the command prompt. Unfortunately, the settings you set aren’t forever.
18. close
Have you cluttered up your command prompt window, trying to run all the commands listed above? You’ll need to know one more command that you’ll need to be aware of to clear it all once more.
That’s all. Bet Marie Kondo didn’t know this one.
19. Systeminfo
This command will provide you with an extensive overview of the configurations on your personal computer. The list will cover the operating system as well as hardware. For instance, you could search for the initial Windows launch date or the most recent boot time, the BIOS version, the total, as well as available memory hotfixes, installed and network card configurations, and many more.
Make use of systeminfo/s with the hostname and system info of the computer on your local network to remote access the data about that system. This could necessitate additional syntax to the user name, domain, and password, such as this:
20. Driverquery
Drivers are one of the most crucial software programs installed on a computer. If they are not properly configured, or missing or outdated Windows drivers could cause all kinds of problems, so it’s a good idea to keep the drivers available on your computer.
This is precisely what exactly the driver query command accomplishes. It can be extended to drive query with -v to find out more details including the directory in which the driver was installed. This command isn’t necessary after Windows 8 or Windows Server 2012.
Windows 8 Only: Recovery Image
The majority of Windows 8/8.1 machines come out of the box with recovery images, however, the image might contain some bloatware you’d prefer not to removed. Once you’ve removed the software you can create a fresh image by using the resume command. The command will give you an extremely complete explanation of how you can utilize it.
You need administrator rights to run the Reimage command. You can access the customized recovery image you make using windows 8 refresh. Windows 8 refresh feature.
With Windows 10, system recovery has been changed. Windows 10 systems don’t come with a recovery partition this makes it more essential than ever to ensure the backup of your data.
Command and Conquer Your Windows PC
This article will only provide a glimpse of the possibilities that lie within this Windows commands line. If you include all variables, there are many commands. Get our comprehensive listing of 100 of the most important Windows CMD commands for an extensive list. It is also possible to download Microsoft’s Windows Command Reference document.