Commands to clean your PC using CMD

cmd

In addition to external cleaning, keeping your computer clean "on the inside" is essential to ensure you get the best performance. There are many ways to do this, but one of the simplest is using the Windows command line. In this article, we'll review the main commands for cleaning your PC using CMD.

The Command Prompt (CMD ) is a well-known tool for Windows users. It's a text-based interface that allows you to manage various aspects of your computer using prompts or commands . To access it, simply type " cmd " in the search bar, right-click on "Command Prompt," and select "Run as administrator."

Below we detail the commands that will help us the most in our task of cleaning our PC using CMD:

To free up disk space

cleanmgr

Cleaning up your hard drive is all about freeing up space by removing obsolete or unnecessary files. CMD offers a few handy commands for this:

«cleanmgr» command

This allows us to launch the Disk Cleanup tool that comes integrated with Windows from the Command Prompt. To open it, simply go to the Command Prompt and type this command:

  • cleanmgr

Next, select the drive you want to clean and follow the on-screen instructions. To make this cleaning easier, you can automate it by entering two new commands:

  • cleanmgr /sageset:1
    cleanmgr /sagerun:1

Command «del»

Another handy command to clean up your PC using CMD is “del”. The correct way to use it is as follows: first, to delete temporary system files you need to enter these commands:

  • del /q /f /s %temp%\* (to delete all files in the temporary folder).
  • del /q /f /s C:\Windows\Temp\* (to delete files from the operating system's temporary folder).

To this we must add one more command, also very useful, to empty the recycle bin: rd /s /q C:\$Recycle.Bin

Repair system files

sfc

Errors in system files can also negatively impact PC performance. Fortunately, CMD has two excellent tools for detecting and repairing these errors: SFC/SCANNOW and DISM.

SFC Command

SFC stands for System File Checker , the tool we use to scan system files for errors and corruption . The complete command we should use is this:

  • sfc / scannow

When activated, the command completely scans the PC files and repairs any corrupted files it finds automatically.

DISM Command

Sometimes, the SFC command isn't enough to repair certain types of files. In those situations, we need to use the DISM ( Deployment Image Servicing and Management ) command, which will help us check the status of the system image. These are the commands you need to enter:

  • DISM / Online / Cleanup Image / CheckHealth (for review).
  • DISM / Online / Cleanup Image / RestoreHealth (for repair).

Optimize hard drive

check disk

Cleaning your PC with CMD also involves optimizing the hard drive and thus improving its performance. Two useful commands that will make this task easier are chkdsk and defrag.

chkdsk command

This is one of the most popular Command Prompt commands. Check Disk ( chkdsk ) scans the hard drive for errors and bad sectors, going more deeply than the commands we saw in the previous section. It also repairs them, often automatically. Here's how to use it:

  • chkdsk C: (for scanning only)
  • chkdsk C: / f / r (to repair errors and recover data).

Important: After using this command, you need to restart your PC.

defrag command

This command is used to defragment the hard drive . This allows for better data reorganization, improving access speed. It can be used as follows:

  • defrag C: (to defragment a disk drive, in this case "C:").
  • defrag C: /A /V (for a detailed report on the status of defragmentation).

Other useful commands to clean our PC using CMD

In addition to the basic commands, there are some others that may be useful in certain circumstances or needs. Take note of them, as you may need them on some occasion:

  • tasklist (shows us the processes that are running on our PC).
  • taskkill /IM ProcessName.exe /F (to end a specific process).
  • wmic product get name (to open a list of all programs installed on the PC).
  • wmic product where name=ProgramName call uninstall (to uninstall a program).

In short, with the CMD or Windows Command Prompt we have an extremely useful tool to clean and optimize our PC. At first, many users may think that it is a very complex resource, but the truth is that, with a little care and practice, anyone can master it in a short time.


Add as preferred source in Google