Summary of common Run CMD commands

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.

Summary of common Run CMD commands

29 Command Prompt Commands You Must Know

1. PING command

Command line: ping ip/host/[/t][/a][/l][/n]

In there:

  • 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.

Summary of common Run CMD commands

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,...

Summary of common Run CMD commands

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.

Summary of common Run CMD commands

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.

7. DEL command

Command line: DEL [/p][/f][/s][/q][/a[[:]attributes]] "tên file cần xóa"

In there:

  • /p: display file information before deleting.
  • /f: delete files with read-only attribute.
  • /s: delete all files that appear in any directory.
  • /q: delete without asking.
  • /a[[:]attributes]: delete by file attributes (R: Read-only files, S: System files, H: Hidden files).

DEL command usage: delete files on the computer.

8. COPY command

Command line:COPY "địa chỉ file cần copy" "địa chỉ lưu file copy" /y

In which: /y is to copy the file without asking.

How to use the COPY command: used when you want to move files from one folder to another folder on your computer.

Summary of common Run CMD commands

9. RD command

Command line:RD /s /q "thư mục cần xóa"

In there:

  • /s: delete entire directory.
  • /q: delete directory without asking.

How to use the RD command: in case we want to quickly delete a folder on the computer, we can apply this command.

Summary of common Run CMD commands

10. MD command

Command line:MD "đường dẫn lưu file cần tạo"\"tên thư mục cần tạo"

How to use MD command: used to create new folder in drive.

For example: MD "D:\Amnhac" to create the Amnhac folder in drive D of the computer.

Summary of common Run CMD commands

11. TASKKILL command

Command line:taskkill /f /im "tên ứng dụng".exe

How to use the TASKKILL command: turn off running software in case the software has problems and cannot be exited directly.

12. REG ADD command

Command line:REG ADD KeyName [/v ValueName] [/t Type] [/s Separator] [/d Data] [/f]

In there:

  • KeyName: path to the key.
  • /v ValueName: name of the value to create in the Registry.
  • /t Type: data type.
  • /d Data: initial data for the value just created.

How to use the REG ADD command: use the command to create and edit the Registry.

13. REG DELETE command

Command line:REG DELETE KeyName [/v ValueName] [/f]

In which: [/v ValueName] is the name of the value to delete.

How to use the REG DELETE command: used when you want to delete a value in the Registry.

14. REGEDIT.EXE command

Command line: Regedit.exe /s "nơi chứa file .reg"

In which: /s no need to ask.

How to use: used when running .reg file.

15. ATTRIB command

Command line: ATTRIB -a -s -h -r "file, thư mục" /s /d orATTRIB +a +s +h +r "file, thư mục" /s /d

In there:

  • + sign: add to attribute.
  • - sign: remove attribute.
  • a: archive is the archive attribute.
  • s:system is a system property.
  • h: hidden is a hidden attribute.
  • r: read-only is a read-only attribute.
  • /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

Summary of common Run CMD commands
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

Summary of common Run CMD commands
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

Summary of common Run CMD commands
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

Summary of common Run CMD commands
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

Summary of common Run CMD commands
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

Summary of common Run CMD commands
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

Summary of common Run CMD commands
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:

systeminfo /s [host_name] /u [domain]\[user_name] /p [user_password]

23. System File Checker command

Summary of common Run CMD commands
System File Checker command

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

Summary of common Run CMD commands
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

Summary of common Run CMD commands
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

Summary of common Run CMD commands
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:

schtasks /create /sc weekly /d FRI /tn "auto reboot computer weekly" /st 23:00 /tr "shutdown -r -f -t 10"

To supplement weekly restarts, you can schedule tasks to launch specific programs at startup:

schtasks /create /sc onstart /tn "launch Chrome on startup" /tr "C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe"

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

Summary of common Run CMD commands
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.

Good luck!

Tags: #System
Sign up and earn $1000 a day ⋙

Leave a Comment

How to Run and Stop Clean Boot on Windows 11

How to Run and Stop Clean Boot on Windows 11

Clean Boot is a troubleshooting technique used to start Windows with a basic, essential set of drivers and startup programs.

How to clone Windows hard drive without third party software

How to clone Windows hard drive without third party software

The cloning process involves moving data from one storage device to another (in this case, a hard drive) with an exact copy copied from the destination drive.

How to Disable Fast Startup on Windows

How to Disable Fast Startup on Windows

Fast Startup Windows 11 helps your computer boot faster, but it can also be the reason why your Windows computer doesn't shut down completely.

How to enable cloud storage file search on Windows 11

How to enable cloud storage file search on Windows 11

Search on Windows 11 pulls results not only from files and apps on your computer, but also from cloud storage linked to your Microsoft account.

Coding is not as difficult as you think

Coding is not as difficult as you think

Once you learn and actually try it out for yourself, you will find that encryption is incredibly easy to use and incredibly practical for everyday life.

How to Open Control Panel on Windows 11

How to Open Control Panel on Windows 11

Control Panel still plays a vital role in many of the configuration tasks you need on your new operating system. Here are a few different ways you can access Control Panel on Windows 11.

How to Enable Unicode UTF-8 in Windows 11

How to Enable Unicode UTF-8 in Windows 11

Changing the display language in Windows 11 may cause some programs to not display text in the language you want. If this is the case, you should enable Unicode UTF-8 to help Windows display text correctly in the language you want.

Microsoft has stopped supporting Internet Explorer, but you can still use it in Windows 11

Microsoft has stopped supporting Internet Explorer, but you can still use it in Windows 11

Internet Explorer was removed from Windows computers in 2022, replaced by Microsoft Edge. While Edge is far superior, Internet Explorer still comes pre-installed on Windows 11 — and it's incredibly easy to access.

6 Free Windows Tools to Find Out Whats Slowing Down Your Computer

6 Free Windows Tools to Find Out Whats Slowing Down Your Computer

Over the years, people have discovered a collection of free Windows tools that help diagnose what's causing their system to slow down.

5 Ways to Open Sound Settings on Windows PC

5 Ways to Open Sound Settings on Windows PC

When you're having audio problems or want to improve your PC's audio levels, it's time to dive into your Windows sound settings and make some tweaks. But did you know there are shortcuts and tricks to quickly get where you need to go?

Summary of ways to fix laptop webcam errors

Summary of ways to fix laptop webcam errors

Errors related to webcams on laptops will affect users when they want to communicate directly via webcam.

Instructions for activating virtual machines on Windows 11

Instructions for activating virtual machines on Windows 11

Virtual Machine on Windows 11 will support users to run an operating system other than Windows right on your computer.

How to turn off Reserved Storage to free up Windows space

How to turn off Reserved Storage to free up Windows space

In case you need to free up urgent storage space, you can temporarily turn off Reserved Storage Windows, according to the article below.

Windows 11s built-in security tools cant protect you from these threats

Windows 11s built-in security tools cant protect you from these threats

Windows today is much better at protecting your security than it used to be, but Windows Security and its associated tools are still not perfect. You need to be on the lookout for threats that computer security doesn't have a solution for.

Outdated Drivers Are Slowing Down Your Windows PC: What to Do?

Outdated Drivers Are Slowing Down Your Windows PC: What to Do?

Windows PCs can sometimes feel slow, but Task Manager doesn't show anything suspicious. At this stage, most people check for malware or storage issues, but outdated drivers can also cause performance issues.

How to Run and Stop Clean Boot on Windows 11

How to Run and Stop Clean Boot on Windows 11

Clean Boot is a troubleshooting technique used to start Windows with a basic, essential set of drivers and startup programs.

How to clone Windows hard drive without third party software

How to clone Windows hard drive without third party software

The cloning process involves moving data from one storage device to another (in this case, a hard drive) with an exact copy copied from the destination drive.

How to Disable Fast Startup on Windows

How to Disable Fast Startup on Windows

Fast Startup Windows 11 helps your computer boot faster, but it can also be the reason why your Windows computer doesn't shut down completely.

How to enable cloud storage file search on Windows 11

How to enable cloud storage file search on Windows 11

Search on Windows 11 pulls results not only from files and apps on your computer, but also from cloud storage linked to your Microsoft account.

Coding is not as difficult as you think

Coding is not as difficult as you think

Once you learn and actually try it out for yourself, you will find that encryption is incredibly easy to use and incredibly practical for everyday life.

How to Open Control Panel on Windows 11

How to Open Control Panel on Windows 11

Control Panel still plays a vital role in many of the configuration tasks you need on your new operating system. Here are a few different ways you can access Control Panel on Windows 11.

How to Enable Unicode UTF-8 in Windows 11

How to Enable Unicode UTF-8 in Windows 11

Changing the display language in Windows 11 may cause some programs to not display text in the language you want. If this is the case, you should enable Unicode UTF-8 to help Windows display text correctly in the language you want.

Microsoft has stopped supporting Internet Explorer, but you can still use it in Windows 11

Microsoft has stopped supporting Internet Explorer, but you can still use it in Windows 11

Internet Explorer was removed from Windows computers in 2022, replaced by Microsoft Edge. While Edge is far superior, Internet Explorer still comes pre-installed on Windows 11 — and it's incredibly easy to access.

6 Free Windows Tools to Find Out Whats Slowing Down Your Computer

6 Free Windows Tools to Find Out Whats Slowing Down Your Computer

Over the years, people have discovered a collection of free Windows tools that help diagnose what's causing their system to slow down.

5 Ways to Open Sound Settings on Windows PC

5 Ways to Open Sound Settings on Windows PC

When you're having audio problems or want to improve your PC's audio levels, it's time to dive into your Windows sound settings and make some tweaks. But did you know there are shortcuts and tricks to quickly get where you need to go?

Summary of ways to fix laptop webcam errors

Summary of ways to fix laptop webcam errors

Errors related to webcams on laptops will affect users when they want to communicate directly via webcam.

Instructions for activating virtual machines on Windows 11

Instructions for activating virtual machines on Windows 11

Virtual Machine on Windows 11 will support users to run an operating system other than Windows right on your computer.

How to turn off Reserved Storage to free up Windows space

How to turn off Reserved Storage to free up Windows space

In case you need to free up urgent storage space, you can temporarily turn off Reserved Storage Windows, according to the article below.

Windows 11s built-in security tools cant protect you from these threats

Windows 11s built-in security tools cant protect you from these threats

Windows today is much better at protecting your security than it used to be, but Windows Security and its associated tools are still not perfect. You need to be on the lookout for threats that computer security doesn't have a solution for.

Outdated Drivers Are Slowing Down Your Windows PC: What to Do?

Outdated Drivers Are Slowing Down Your Windows PC: What to Do?

Windows PCs can sometimes feel slow, but Task Manager doesn't show anything suspicious. At this stage, most people check for malware or storage issues, but outdated drivers can also cause performance issues.