To access a folder on the computer, or execute some commands on Windows, we often use the Run dialog box and enter the path or command. This will help users access and operate faster. Or some accesses on Windows require using this command line interface. Therefore, having common and frequently used Run CMD commands in hand will help us get results faster. In the article below, we will summarize common Run commands for readers.
First, we need to open the Run dialog box using the Windows + R key combination and type the keyword cmd , press OK to access.
ip: IP address of the computer to be checked, host is the name of the computer to be checked for network connection. Users can use either the IP address or the computer name.
/t: requests to continuously send packets to the destination machine until you press Ctrl + C to end.
/a: get IP address from computer name.
/l: specifies the width of the packet sent for testing.
/n: specifies the number of packets sent.
How to use the PING command: we can use the PING command line when we want to check whether the computer is connected to the Internet or not. When executing the PING command, packets from the computer to be checked are sent to the destination computer, from which the user can check the transmission line or determine whether the computer is connected to the network or not.
2. Tracert command
Command line:tracert ip/host
In which: ip/host is the IP address or computer name to be checked.
How to use the Tracert command: The Tracert command is used to display the path of packets from the testing computer to the destination computer, through which server or router.
3. Netstat command
Command line:Netstat [/a][/e][/n]
In there:
/a: displays all connections and open ports.
/e: Ethernet statistics information.
/n: display addresses and port numbers.
How to use the Netstat command: helps users know the connections in and out of the computer they want to check.
4. Ipconfig command
Command line:ipconfig /all
How to use the command ipconfig /all: displays information of the computer being checked including host name, IP address, DNS,...
5. Shutdown command
Command line:
Shutdown -s -t [a]: shutdown (on Windows 7).
Shutdown -r -t [a]: start the machine.
In which: a is the time to turn the machine on or off, calculated in seconds.
How to use the Shutdown command: shut down or restart the computer according to a preset schedule. In addition, readers can refer to how to schedule shutdown for Windows 10 computers in the article Instructions for scheduling shutdown of Windows 10 computers .
6. DIR command
Command line:DIR [drive:] [path][filename]
In there:
Path: path to file or directory.
Filename: file name.
DIR command function: helps users search and check files and folders on the computer.
/s: execute with all files in the directory and subdirectories.
/d: set attributes for directories and subdirectories.
Usage: used to set attributes for files or folders.
16. Assoc command
Assoc command
Most files in Windows are associated with a specific program that is assigned to open the file by default. Sometimes it can be confusing to remember these associations. You can remind yourself by entering the assoc command to display a complete list of file name extensions and program associations.
You can also expand the command to change file associations. For example, assoc .txt= will change the association for text files to whatever program you type after the equals sign. The Assoc command itself will reveal both the extension name and the program name, which will help you use the command correctly.
In Windows 10, you can see a more user-friendly interface, which also allows you to change file type associations on the fly. Go to Settings (Windows + I) > Apps > Default apps > Choose default app by file type .
17. Cipher command
Cipher command
Removing files on a mechanical hard drive doesn't actually delete them. Instead, it marks the files as inaccessible and the space they take up becomes unused. The files remain recoverable until the system overwrites them with new data, which can take some time.
However, the cipher command will delete a directory by writing random data to it. For example, to delete drive C, you would use the cipher /w:d command , which will wipe the free space on the drive. The command does not overwrite undelete data, so you will not wipe out the files you need by running this command.
You can use a variety of other cipher commands, however, they are often redundant with versions of Windows that support BitLocker .
18. Driverquery command
Driverquery command
Drivers are still some of the most important pieces of software installed on your PC. Missing or incorrectly configured drivers can cause all sorts of problems, so it’s good to have access to a list of the drivers on your PC. That’s exactly what the driverquery command does. You can expand it to driverquery -v to get more information, including the directory in which the driver is installed.
19. File Compare command
File Compare command
You can use this command to determine the text differences between two files. It is especially useful for writers and programmers trying to find small changes between two versions of a file. Just type fc , followed by the directory path and names of the two files you want to compare.
You can also extend the command in a number of ways. Typing /b compares only binary output, /c ignores uppercase and lowercase in comparisons, and /l compares only ASCII text.
So, for example, you could use the command like this:
fc /l "C:\Program Files (x86)\example1.doc" "C:\Program Files (x86)\example2.doc"
The above command compares the ASCII text in two Word files.
20. PathPing Command
PathPing Command
This is a more advanced version of ping that is useful if there are multiple routers between your PC and the device you are testing. Like ping, you use this command by typing pathping followed by the IP address, but unlike ping, pathping also relays some information about the path the test packets take.
21. Powercfg command
Powercfg command
Powercfg is a very powerful command for managing and monitoring how your computer uses power. You can use the powercfg hibernate on and powercfg hibernate off commands to manage hibernation; or you can also use the powercfg /a command to see the current power saving states on your PC.
Another useful command is powercfg /devicequery s1_supported , which displays a list of devices on your computer that support connected standby. When enabled, you can use these devices to wake your computer from standby, even remotely. You can enable this feature by selecting the device in Device Manager , opening the device's properties, going to the Power Management tab , and then checking the Allow this device to wake the computer box .
Powercfg /lastwake will tell you which device last woke your PC from sleep. You can use this command to troubleshoot your PC if it seems to be randomly waking up from sleep.
You can use the powercfg /energy command to generate a detailed power consumption report for your PC. The report is saved to the specified folder after the command finishes. This report will tell you about any system errors that may be causing increased power consumption, such as devices that block certain sleep modes or are poorly configured to meet your power management settings.
Windows 8 added powercfg /batteryreport , which provides detailed analysis of battery usage, if available. Typically exported to your Windows user folder, the report provides details on the duration and length of charge and discharge cycles, average battery life, and estimated battery capacity.
22. Systeminfo command
Systeminfo command
This command will give you an overview of your computer's detailed configuration. The list includes your operating system and hardware. For example, you can look up the original Windows installation date, last boot time, BIOS version, total and available memory, installed hotfixes, network card configuration, and more.
Use systeminfo /s followed by the host name of a computer on the local network, to get remote information for that system.
This may require additional syntax elements for domain, username, and password, as follows:
System File Checker is an automatic scanning and repair tool that focuses on Windows system files.
You'll need to run Command Prompt with admin rights and enter the command sfc /scannow . If SFC finds any corrupt or missing files, it will automatically replace them using cached copies kept by Windows specifically for this purpose. The command may take half an hour to run on older laptops.
24. Tasklist command
Tasklist command
You can use the tasklist command to get a current list of all the tasks running on your PC. While somewhat redundant given the existence of Task Manager , this command can sometimes find tasks that are hidden from view in that utility.
There are also a variety of modifiers. Tasklist -svc shows the services associated with each task, use tasklist -v for more details on each task, and tasklist -m will locate the DLL files associated with the active tasks. These commands are useful for advanced troubleshooting.
25. Chkdsk command
Chkdsk command
Windows automatically flags a drive for a diagnostic chkdsk scan when symptoms indicate that the local drive has bad sectors , lost clusters, or other logical or physical errors.
If you suspect your hard drive is failing, you can start a scan manually. The most basic command is chkdsk c: , which will immediately scan the C: drive without restarting your computer. If you add parameters like /f, /r, /x, or /b , as in chkdsk /f /r /x /bc: , chkdsk will also repair errors, recover data, unmount the drive, or clear the bad sector list, respectively. These tasks require a reboot, as they can only run when Windows is powered off.
26. Schtasks command
Schtasks command
Schtasks is Command Prompt access to Task Scheduler, one of the many underrated Windows admin tools. While you can use the GUI to manage your scheduled tasks, Command Prompt lets you copy and paste complex commands to set up multiple similar tasks without having to click through multiple options.
For example, you can schedule your computer to restart at 11pm every Friday:
To replicate the above command for different programs, just copy, paste and modify it as needed.
27. Net Use command
If you want to map a new drive, you can always open File Explorer , right-click This PC , and go through the steps in the Map Network Drive wizard . However, using the Net Use command, you can do the same thing with a series of commands.
For example, if you have a shared folder on a computer on your network named \\OTHER-COMPUTER\SHARE\ , you can map it to your own Z: drive by typing the command:
net use Z: “\\OTHER-COMPUTER\SHARE” /persistent:yes
A persistent switch tells your computer that you want this drive to be remapped every time you log back into your computer.
28. Format command
Windows Command Prompt displays the format command with various parameters.
When you need to format a drive, you can use the Windows File Explorer GUI or switch to Command Prompt. You will need admin rights to use this command. Make sure you specify the volume you want to format, followed by the desired parameters.
The command below will quickly format drive D with exFAT file system, with size of 2048 bytes and rename the volume to "label" (without quotes).
format D: /Q /FS:exFAT /A:2048 /V:label
You can also use this command to unmount the volume (/X) or, if it is formatted with NTFS, set the file compression mode to the default setting (/R). If you get stuck, use format /? to search for help.
29. cls command
If you find yourself cluttering up your Command Prompt window trying all of the commands above, there's one final command you need to know to clean it all up again.
cls
That's all! Very simple right?
Other Windows CMD Commands
As you can see, there are some useful and powerful things you can do with the Windows Command Prompt, if you know the right commands.
There are even many commands that give you the ability to do some things that you might never have thought possible just by typing a simple command.
BITSADMIN : Start upload or download jobs over the network or Internet and monitor the current status of those file transfers.
COLOR : Change the background color of the Command Prompt window.
COMP : Compare the contents of any two files to see the differences.
FIND/FINDSTR : Search for strings within any ASCII file.
PROMPT : Change the command prompt from C:\> to something else.
TITLE : Change the title of the Command Prompt window.
REGEDIT : Edit keys in Windows registry (use with caution).
ROBOCOPY : A powerful file copy utility built right into Windows.