Summary of common Run CMD commands

Summary of common Run CMD commands

To access a certain directory on the computer, or execute some commands on Windows, we usually go to the Run dialog box and enter the path or command. This will help users to access and manipulate faster. Or, some of the accesses on Windows require this command-line interface. So, having the common and frequently used Run CMD commands in hand will help us get results faster. In the article below, we will summarize the common Run commands to readers.

First of all, we need to open the Run dialog with Windows + R key combination and type cmd , click OK to access.

26 Command Prompt commands you must know

  • 1. PING command
  • 2. Tracert command
  • 3. The Netstat command
  • 4. Ipconfig command
  • 5. Shutdown command
  • 6. DIR command
  • 7. DEL order
  • 8. COPY order
  • 9. RD instruction
  • 10. MD Order
  • 11. The TASKKILL order
  • 12. REG ADD command
  • 13. REG DELETE command
  • 14. REGEDIT.EXE command
  • 15. ATTRIB Order
  • 16. Assoc command
  • 17. Cipher command
  • 18. Driverquery command
  • 19. File Compare command
  • 20. PathPing command
  • 21. Powercfg command
  • 22. Systeminfo command
  • 23. The System File Checker command
  • 24. Tasklist command
  • 25. The Chkdsk command
  • 26. The Schtasks Order

1. PING command

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

Inside:

  • ip: IP address of the computer to check, host is the name of the computer to check the network connection. You can use the IP address or the name of your computer.
  • / t: asks to send packets continuously to the destination host until you press Ctrl + C to finish.
  • / a: get IP address from computer name.
  • / l: defines the width of the outgoing test packet.
  • / n: specifies the number of packets to be 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 you want to check are sent to the target computer, from which the user can check the transmission line or determine if 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 the computer name to check.

How to use Tracert command: Tracert command is used to show the path of packets from the test computer to the target computer, through which server or router.

3. The Netstat command

Command line: Netstat [/ a] [/ e] [/ n]

Inside:

  • / a: shows all open connections and ports.
  • / e: Ethernet statistics information.
  • / n: displays the addresses and port numbers.

How to use the Netstat command: helps users know the incoming and outgoing connections on the computer they want to check.

4. Ipconfig command

Command line: ipconfig / all

How to use the ipconfig / all command: display 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 off or turn on the computer in seconds.

How to use the Shutdown command: shut down or restart the computer according to a scheduled schedule. In addition, readers can refer to how to schedule a shutdown for Windows 10 computers in the article Windows 10 computer shutdown schedule guide.

6. DIR command

Command line: DIR [drive:] [path] [filename]

Inside:

  • Path: path to the file or directory.
  • Filename: filename.

Use DIR command: help users to search and check files and folders on the computer.

7. DEL order

Command line: DEL [/ p] [/ f] [/ s] [/ q] [/ a [[:] attributes]] “filename to delete”

Inside:

  • / p: displays file information before deletion.
  • / f: delete files that are read-only.
  • / 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).

Use of DEL command: delete files on the computer.

8. COPY order

Command line: COPY “copy file address” “copy file location” / y

In which: / y is to copy files without asking.

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

9. RD instruction

Command line: RD / s / q “directory to delete”

Inside:

  • / s: delete all directories.
  • / q: delete the directory without asking.

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

10. MD Order

Command line: MD “path to save the file to create” “directory name to create”

How to use the MD command: used when creating a new directory on the drive.

For example: MD “D: Amnhac” to create the Amnhac folder in drive D computer.

11. The TASKKILL order

Command line: taskkill / f / im “application name” .exe

How to use the TASKKILL command: Turn off running software in case the software has problems, can not exit directly.

12. REG ADD command

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

Inside:

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

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

13. REG DELETE command

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

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

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

14. REGEDIT.EXE command

Command line: Regedit.exe / s “where the .reg file is located”

In which: / s do not need to ask.

Usage: Used when running .reg files.

15. ATTRIB Order

Command line: ATTRIB -a -s -h -r “file, directory” / s / d or ATTRIB + a + s + h + r “file, directory” / s / d

Inside:

  • +: Add to an attribute.
  • Sign -: remove an attribute.
  • a: archive is an archive attribute.
  • s: system is a system property.
  • h: hidden is a hidden property.
  • r: read-only is a read-only property.
  • / s: works with all files in folders and subfolders.
  • / d: set properties to folders and subdirectories.

Usage: Used to set properties for files or folders.

16. Assoc command

The Assoc command

Most files in Windows are associated with a specific program that is assigned to open files by default. At times, remembering these links can get confusing. You can prompt yourself by typing the assoc command to display a complete list of file name extensions and program links.

You can also extend the command to change file associations. For example, assoc .txt = will change the association for text files to whatever program you enter after the equal sign. The Assoc command itself will reveal both the extension name and the program name, which will help you properly use this command.

In Windows 10, you can see a more user-friendly interface, which also allows you to change file type associations in an instant. Go to Settings (Windows + I)> Apps> Default apps> Choose default app by file type .

17. Cipher command

Cipher command

Removing files on the hard drive doesn’t actually delete them. Instead, it marks files as inaccessible and the space they occupy becomes unused. Files are still recoverable until the system overwrites them with fresh data, which may 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 command cipher / w: d , which will wipe free space on the drive. The command does not overwrite undeleted data, so you will not wipe the files you need by running this command.

You can use a variety of other cipher commands, however, these are often redundant with BitLocker-enabled versions of Windows.

18. Driverquery command

Driverquery command

Drivers are still one of the most important pieces of software installed on a PC. Missing or incorrectly configured drivers can cause all kinds of trouble, so it’s good to have access to the list of drivers present 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 where the driver is installed.

19. File Compare command

The File Compare command

You can use this command to determine the text difference between the two files. It is especially useful for writers and programmers trying to find slight changes between two versions of a file. Just type fc , followed by the directory path and the names of the two files you want to compare.

You can also extend the command in a number of ways. Input / b compares binary output only, / c ignores capitalization, lower case in comparison, and / l compares ASCII text only.

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 ASCII text in two Word files.

20. PathPing command

The PathPing command

This is a more advanced version of ping which is very 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 forwards some information about the path of the test packets.

21. Powercfg command

Powercfg command

Powercfg is a very powerful command to manage and monitor how your computer uses energy. 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 view available power saving statuses on your PC.

Another useful command is powercfg / devicequery s1_supported , which shows a list of devices on the computer that support connected standby mode. When enabled, you can use these devices to take your computer out of standby mode, 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 let you know which device woke your PC from sleep state last. You can use this command to troubleshoot your PC, if it seems to have accidentally woken up from sleep mode.

You can use the powercfg / energy command to build a detailed power consumption report for your PC. The report saves to the specified folder after the command ends. This report will tell you about any system failures that could increase power consumption, such as a device that blocks certain sleep modes or is poorly configured to meet management settings. your energy.

Windows 8 has added powercfg / batteryreport , which provides a detailed breakdown of battery usage, if available. Usually export to your Windows user directory, reports provide detailed information about charge and discharge cycle duration and length, average battery life and estimated battery capacity.

22. Systeminfo command

Systeminfo command

This command will give you an overview of the detailed configuration of your computer. 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 available memory and memory, installed hotfixes, network card configuration, and so on.

Use systeminfo / s followed by the host name of the computer on the local network, to get remote information for that system.

This may require additional syntax elements for the domain, username, and password, like these:

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

23. The System File Checker command

System File Checker command

System File Checker is an automatic scan and repair tool that focuses on Windows system files.

You will need to run the Command Prompt with admin privileges and enter the command sfc / scannow . If the SFC finds any files that are corrupt or missing, it will automatically replace them using the cached copies that are kept exclusively by Windows 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 provide a current list of all the tasks running on your PC. Although a bit redundant because there is Task Manager, this command can sometimes find tasks hidden from view in this utility.

There is also a wide range of modifiers. Tasklist -svc displays the services related to each task, uses tasklist -v for more details about each task, and tasklist -m will locate the DLLs associated with the active tasks. These commands are useful for advanced troubleshooting.

25. The Chkdsk command

The Chkdsk command

Windows automatically marks the drive for a diagnostic chkdsk scan when symptoms show that the local drive has bad sectors, loss of clusters, or other logical or physical errors.

If you suspect your hard drive is faulty, you can initiate a manual scan. The most basic command is chkdsk c:, which will immediately scan the C: drive without restarting the computer. If you add parameters like / f, / r, / x or / b , such as in chkdsk / f / r / x / bc:, chkdsk will also fix errors, restore data, unmount the drive or delete list of bad sectors, respectively. These tasks require a restart, as they can only run when Windows is powered off.

26. The Schtasks Order

The Schtasks command

Schtasks is the Command Prompt access to Task Scheduler, one of many underrated Windows administration tools. While you can use the GUI to manage your scheduled tasks, the Command Prompt allows you to copy and paste complex commands to set up many similar tasks without having to click through multiple options. choose different.

For example, you can schedule a restart of your computer 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 the weekly reboots, you can schedule tasks to launch specific programs at startup:

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

To copy the above command for different programs, just copy, paste and modify it if needed.

I wish you all success!