CMDComputerHow ToWindows 10

How to Clean your Windows PC using CMD (Command Prompt)

If you are using the latest version of Windows, you might know that the operating system fills up the storage very quickly. This is because we install lots of programs on our computer.

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)

2 Methods to 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 are going to defrag our hard disk via CMD. This method will clean all junk files stored on selected drives. Let’s check out.

Step 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.’

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

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

Step 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.’

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

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

Step 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

Step 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 related to this, let us know in the comment box below.

Show More

Amir Hussain

Amir Hussain is the founder of Freemium World, a geek by nature and a professional Blog writer . I love to write about new technology trends, social media, hacking, blogging and much more.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button
Outfit Ideas