Keeping your computer free from clutter is one of the ways to improve performance and stability. By just cleaning up the junk files, you can free up tons of disk space. Additionally, Windows 10 & 11 offer several built-in system junk cleaning utilities to free up storage space. Although it’s pretty easy to access those tools, wouldn’t it be easier to access the hidden tools via CMD? Also read: How to Reset Windows 10/11 via CMD (Command Prompt)

Clean Your Windows PC using Command Prompt

In this article, we will share some of the best methods to clean your Windows PC via Command Prompt. The methods shared below are very easy to follow. So, let’s check out.

1. Defragment Hard Disk via CMD

In this method, we will defrag our hard disk via CMD. This method will clean all junk files stored on selected drives. Let’s check out.

  1. First of all, click on the Windows Start button and type in ‘CMD‘. Next, right-click on the Command Promot and select Run as Administrator.

  2. On the Command Prompt, enter the command: defrag c:

Important: The above command will defrag the C: Drive of your PC. Change the drive letter if you want to defrag any other drive. 3. Now, the Disk Defragment tool will scan the selected drive and will remove the junk & temp files.

That’s it! You are done. This is how you can run the Disk Defragment tool via CMD.

2. Run Disk Cleanup Utility via CMD

In this method, we will run the built-in Disk Cleanup utility of Windows 10 to free up storage space. Follow some of the simple steps given below.

  1. First of all, click on the Windows Start button and type in ‘CMD‘. Next, right-click on the Command Promot and select Run as Administrator.

  2. Now, on the Command Prompt, type in cleanmgr and hit the Enter button.

  3. This will launch the Disk Cleanup utility. Select the drive you want to clean and click on the ‘Ok‘ button.

  4. If you wish to skip the drive selection pop-up, enter the command: cleanmgr /sageset

  You need to select the files to delete after executing the above command 5. If you wish to delete files automatically, then execute the command: cleanmgr /sagerun

The above command will automatically scan your drives and delete junk files from your PC. So, this guide is all about how to clean your Windows 10/11 PC via Command Prompt. I hope this article helped you! Please share it with your friends also. If you have any doubts about this, let us know in the comment box below.

How to Clean your Windows PC using CMD  Command Prompt  - 9How to Clean your Windows PC using CMD  Command Prompt  - 53How to Clean your Windows PC using CMD  Command Prompt  - 54How to Clean your Windows PC using CMD  Command Prompt  - 91How to Clean your Windows PC using CMD  Command Prompt  - 38How to Clean your Windows PC using CMD  Command Prompt  - 59How to Clean your Windows PC using CMD  Command Prompt  - 75How to Clean your Windows PC using CMD  Command Prompt  - 45How to Clean your Windows PC using CMD  Command Prompt  - 12How to Clean your Windows PC using CMD  Command Prompt  - 66How to Clean your Windows PC using CMD  Command Prompt  - 30