Windows CMD command prompt is an integral part of Windows, and you can easily control your Windows OS with this command prompt. Although, the application of command prompt is decreasing day by day because of introducing GUI-based input. But still, there is some command prompt that is useful and easy to use. Everyone without any technical knowledge can use this command to operate and solve troubleshooting issues in their Windows OS efficiently. In this article, we have presented the 30 most helpful command prompts that you must know.
How To Open Command Promot in Windows PC
To open the CMD command prompt is so easy. With a few clicks, you can open it in your Windows Operating Systems.
Step 1: First of all, Open the Run dialog box. To open the Run dialog box, you can press the shortcut key WIN+R, type “cmd” on the Run dialog box, and hit Enter or press OK.
Step 2: Alternatively, you can open the CMD command prompt by going to Start Menu and writing the “cmd” on the search box just beside Start Menu.
Noted that the command prompt is user-friendly and it is not case-sensitive. So you can type the command script quickly.
CMD Command Prompt Command
If you don’t know the use of the command prompt command, you miss many things in Windows. CMD helps you to automate tedious tasks in a few clicks without having IT knowledge. Though, most users find it difficult to manage many command lines compared to modern interfaces. However, it is still helpful in many situations.
1. Display Installed Device Drivers
Drivers are the most essential installed software on a computer. If any driver is not configured correctly, missing, or corrupted, your Windows can not perform effectively. So you can make a query to find the list of device drivers installed on your computer. If any driver is missing, you can see this by using the cmd command prompt.
driverquery to find the list of installed device drivers. Moreover, you can use
driverquery -v to obtain more information, including knowing the driver installed directory.
2. Networking Information
This command provides the IP address of your computer. This command prompt lets you know the details of networking information such as IP address, Submask, gateway, etc. However, you are connected with a router, and you will receive the local network address of the router.
ipconfig to get details of networking information. Moreover, to refresh your DNS address, you can use the cmd command
ipconfig/flushdns. This command is useful when your PC faces a network troubleshooting problem.
3. Display Configuration
This command lets you know the detailed configuration of your PC like Operating System, hardware. After providing this cmd command, you know your operating system version, system installation date, system boot time. Furthermore, you also know hardware configuration such as processor, memory, hotflix, network card, monitor.
To know the basic information of computer hardware and operating systems using a command prompt
4. Test Network Connection
Sometimes, you need to know whether or not packets are reachable. Typing
ping sends a packet of commands to a specific IP address or a web address and lets you know how long it takes a response.
If it arrives and returns, you can ensure that your computer can connect with the particular device. If it fails, so you know that something is blocking between your Computer and device. The reason behind this connection failure is improper network configuration or device damage.
So type simply
ping and get an update of your network connection.
5. Test Network Latency
Pathping is the advanced cmd command of
ping that is used to test the traceroute and network latency in your Windows OS. When you need to test the traceroute between multiple routers and devices, you use the cmd command
pathping. This command sends multiple echo messages between each route and calculates the aggregate number of packets returned. It identifies which routers are on the path.
6. Test Route to a Remote Host
Tracert is similar to
pathping command. With this cmd command, you will receive information about the route between your computer and a remote host. For example, when you type,
tracert facebook.com it traces a route to facebook over a maximum of 30 hops. Moreover, you can also know how much time each hop is between your device and server with this command.
7. System File Checker
sfc to find any corrupt or missing files on your Windows system files. Here sfc means System File Checker, which automatically scans and repairs your Windows system files. If it finds any error, then use
sfc/scannow to fix the error by replacing the cashed copy.
8. List of Running Application
tasklist command to drill down the current list of tasks in your running Computer. Sometimes you can find the task list which is hidden in the Task Manager. However, there are some other modifiers in this command.
For example, use
tasklist -svc to know the service-related task, use
tasklist -v to obtain more details of the task, and use
tasklist -m to locate DLL associated with the active task.
9. End Running Process
When you find the list of running applications using the
tasklist command, you also get the process ID (four or five digits). You can end the process of a particular application by using
taskkill the cmd command.
You can forcefully stop a running program by using
taskkill -im followed by an executable program name or using
taskkill -pid followed by application process PID. Yes, you can stop a running program by using Task Manager, but this cmd command can stop hidden or unresponsive programs.
10. Change Directory
If you want to change the directory, use
cd. This command will take you to the directory tree. Besides, type
cd folder to go to the folder of the directory. For example, to go to the Windows folder, type cd windows.
And use backslash character
\ to jump in the subfolder. For example, to go to the Windows/System32 type
cd windows/system32. Moreover, use
cd.. to go back to the previous folder.
11. Change the Drive
This Windows cmd command is mainly used to change the drive from C to D, type
d: and press Enter. Alternatively, if you want to go back to the C:\windows, then type
cd/d c:\windows and press Enter. You can change your drive or jump to another folder and just use the cmd command.
12. Create a New Folder
Creating a new folder is so easy by using the cmd command. Use
mkdir (Make Directory) command to create a new folder. Type, here folder means your folder name. For example, you won’t create a new folder in C drive as the name of Ubuntu, so type
mkdir ubuntu in drive C.
Moreover, if you want to know the newly created folder list, type
dir only. On the other hand, if you are in drive C, but you want to create a new folder in drive D as new name Bing, type
mkdir d:\Bing and press Enter.
13. Display File Extension Associations
Windows files are associated with a specific program, and this program helps to open the file. Usually, this file extension is hidden, and it isn’t easy to remember. You use
assoc command to see the file extension associated program name.
14. Encrypt/Decrypt File or Folder
Cipher display the encrypt and decrypt file or folder status in a directory. When you type
Cipher after the subfolder of the directory, it shows the list of encrypted or decrypted files. The prefixed with an E represents the list of the encrypted files, and the prefixed with a U represents the list of the decrypted files.
15. Compare Two Files
By using the cmd command
fc you can compare the difference in text between the two files. This Windows cmd command is helpful for the writers and programmers to find out the slight difference between two files.
First of all, to compare two files, type the
fc and then write the directory name and file name that you want to compare. For example, you can write a command like that
fc /l "C:\Program Files(x86)\file.txt" "C:\Program Files(x86)\file2.txt"
16. Display Networking Status
Entering the command
netstat will display the list of open ports and connected IP addresses. This command lets you know the status of your port; established, closed. This cmd command is useful for solving a networking troubleshooting problem or finding a trojan attack.
17. Configure Power Settings
powercfg to manage your computer power energy. By typing
powercfg hibernate on or
powercfg hibernate off you can manage the hibernation feature. On the other hand, you can also know the power-saving states by typing
powercfg/a. Besides, another command
powercfg /devicequery s1_supported lets you see the list of devices that are connected to standby. Like this, there are several useful commands of
powercfg /lastwake provides a report about the computer’s last event that woke your PC from a sleep state.
powercfg /list to know the current user’s power schemes (GUIDs).
powercfg /energy to generate power consumption reports in the directory.
If you use Windows 8 or updated Windows version, you can generate the details of the battery usage report. This report shows batter lifetime, battery capacity, length of charge, and charges cycle.
18. Turn off Your Computer
If you want to turn off your PC, you can do it by using the cmd command
shutdown. Use more syntax like
shutdown /r /o to restart your computer and launch the advanced boot option automatically so that you can access Windows Safe mode and recovery utilities. This command is useful to restart your computer for troubleshooting issues.
Besides, there are some other shutdown syntaxes to shut down your PC for different purposes. Use
shutdown /f to forcefully shut down your Computer without giving the option to save the open program. As a result, this command will result in data loss.
You can use
shutdown /soft that will provide an option to choose shutdown/restart/logoff. Moreover, this command lets you close the running program before shutting down your system and wait until the end of the process.
19. Check and Repair Drive Problem
To run command
chkdsk, you can diagnosis your computer. This command suggests your next step and also lets you know if it finds any symptoms of bad sector, data loss, physical error on your Computer. Besides, if you think your Windows goes wrong, you initially scan your computer to find out the problem.
Usually, you need to type the cmd command
chkdsk c: to scan your drive C. This command only scans your computer and produces a report about the lost allocation of your C drive.
If any corruption is found after the scan, you need to use
chkdsk /f c: to fix the file disk error automatically.
Use some other parameters like use
chkdsk /r c: to recover data, use
chkdsk /x c: to dismount the drive, and use
chkdsk /b c: to clear bad clusters on the drive.
20. Format a Drive
If you need to format a drive, you can either use Windows File Explorer GUI or a Windows cmd command prompt. If you know the cmd command code to format a drive, you can do this quickly. But you need administrative rights to use this command when you ensure administrative rights and the amount of volume to format.
Suppose, to format 1GB of drive D with the exFAT file system, and your cmd command code would be
format D: /Q /FS:exFAT /A:2048 /V:label.
On the other hand, to reformat the entire drive D with the NTFS file system, the cmd command would be
format D: /FS:NTFS /x.
21. Schedule Task
Windows has a wizard to create a scheduled task. You can set a scheduled task by either using Task Manager or use the cmd command. We are used to creating scheduled tasks using the Task Manager app, but if you can memorize the cmd command for scheduled tasks, you can set it quickly compared to the Task Manager setting. The basic formula to create a scheduled task is
SCHTASKS /Create [Connect_Options] Create_Options /TN taskname
And, you can set a scheduled frequency for minutes, hourly, daily, weekly, monthly, once. The parameter for setting time to modify based on the minute, hourly, daily, and weekly will be-
1 – 1439 minutes for minute modify.
1 – 23 hours for hourly modify.
1 – 365 days for daily modify.
1 – 52 weeks for weekly modify.
Besides, there is a day and month modifier based on the day and month name. If your task will be to run the bat file from C:\temp folder every day at noon so that the cmd command will be
SCHTASKS /Create /SC HOURLY /MO 12 /TR BAT /TN c:\temp\File1.bat
If you successfully create a scheduled task, you will receive a confirmation message on your command prompt dialog box as SUCCESS: The scheduled task “BAT” has successfully been created.
22. Change File Attribute
To change the file attribute right click on the file and select properties. When file properties appear, you can change attributes by selecting or deselecting the attributes. The same job can be done by using the cmd command. The basic formula to change file attribute
ATTRIB [ + attribute | - attribute ] [pathname] [/S [/D]] [/L]
The key attributes are ‘R’ for Read-only, ‘A’ for Archive, ‘S’ for System, ‘H’ for Hidden and the pathname key /S for search pathname, /D for process folders, /L for the symbolic difference link between work on the attributes and target. So if you want to change the attribute of file C:\downloads\flower.jpg, then your cmd command will be
ATTRIB +R +H C:\users\user\downloads\flower.jpg
23. Rename a File Name
To rename a file name, select the file, right-click on the mouse, and select the rename option. When rename option is available, then you can change the name of the file. If you know the Windows cmd command to rename a file name, you can rename a file name easily without clicking several times. The basic formula for rename command is
ren [drive:][path]SourceMask TargetMask
So, if you want to change newdoc.txt to olddoc.txt, then your command code is
ren newdoc.txt olddoc.txt
24. Display the Hostname of the Computer
Every Windows OS computer has a device name. This device name identifies the name of itself to other devices and networks on your LAN. You can find this name on your computer in your system GUI, but you find it quickly in the cmd command prompt.
To find the hostname of your computer, go to your cmd command prompt and type
hostname , and press Enter
25. Recover a Damaged File
Somehow, your hardware has been corrupted, and you need to recover some important files, then the cmd command prompt
recoveris helpful. This command can read sector by sector and retrieve all readable data.
If your data is stored in the bad sector, this command can not recover that file. But it can recover files from the good sector in hardware. So this file can partially recover data. However, this is useful when you need to retrieve important data from corrupted hardware.
26. Use Function Keys as a Shortcut of CMD
Do you know that the function keys such as F1 to F9 work as shortcut keys for various Command Prompt functions? Here, let’s check out what function key in your keyboard performs what in CMD:
- F1: To retype your last command letter by letter, you need to press this function key.
- F2: Copy the special character of the current command.
- F3: To retype the previous command.
- F4: Delete the special character for the current command.
- F5: Retype before the command of the last command.
- F6: To enter the EOF indicator use this command.
- F7: To open the list of the previously entered commands.
- F8: Similar to F5, it shows before the command of the last command. Moreover, if there are no previous two or more commands, it shows the latest one.
- F9: When you press this function key, a pop-up comes where you need to enter the command number and jump to that command.
27. Run Multiple Commands
When you need to run multiple commands, then you can use
&&. This command saves your time to run back-to-back commands. For example, when you need to know networking information and display configuration, your command will be
ipconfig && systeminfo
28. Change CMD Command Prompt Color
By default, the cmd command prompt color is black, and the text color is white. If you want to change the default color, you need to use a color code. The basic command for changing CMD command prompt color is
Here ‘Background’ means the terminal’s background color, and ‘Foreground’ means the terminal’s font color.
The HEX value of the colors of the command prompt:
0 = Black 8 = Gray 1 = Blue 9 = Light Blue 2 = Green A = Light Green 3 = Aqua B = Light Aqua 4 = Red C = Light Red 5 = Purple D = Light Purple 6 = Yellow E = Light Yellow 7 = White F = Bright White
Suppose you want to change your command prompt background to white, and the font color is black. Then, your color command is
Similarly, you can change your command prompt color as your like. Despite this, if you want to know the related information about all color command in command prompt, you command will be
29. List of Commands
When you frequently use this Windows cmd command prompt, the cmd command
Helphelps you find the list of commands. It is not possible to remember all list of commands. But when you feel comfortable using the cmd command to change the Windows system, you get all command lists to press
help in the cmd command prompt.
30. Clean Screen
You have worked on the cmd command prompt for a long time. Many commands are already applied, and your command prompt dialog box is cluttered up. You can clear your command prompt screen type a simple code
cls and see the magic!
Thanks for reading the full article. I hope this article helps you and makes easier your Windows working experience. Especially those with a non-technical background can quickly solve many Windows troubleshooting issues using the cmd command prompt. However, this is not all list of cmd commands.
We cover the most frequently used cmd command list. If you want to share anything about this guide, you can share your comment in our comment box. Moreover, you can share this article with your friends, and they will benefit from reading this article. So let’s enjoy coding and be happy to become a member of a good computing club!