Hit Subscribe!

Don’t Be a Noob, Subscribe Already!

How-To

How to Clean your Windows PC using CMD

Keeping your computer free from clutter is one way to improve performance and stability. Just cleaning up the junk files can free up tons of disk space.

Windows 10 & 11 also 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?

This article will share some of the best methods to clean Windows PC via Command Prompt.

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, click the Windows Start button and type in CMD. Next, right-click on the Command Promot and select Run as Administrator.

open CMDopen CMD

2. On the Command Prompt, enter the command:

defrag c:

defrag c: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 remove the junk & temp files.

2. Run Disk Cleanup Utility via CMD

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

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

open CMDopen CMD

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

cleanmgrcleanmgr

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

Disk Cleanup utilityDisk Cleanup utility

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

cleanmgr /sageset

cleanmgr /sagesetcleanmgr /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

cleanmgr /sageruncleanmgr /sagerun

The above command will automatically scan your drives and delete junk files from your PC.

3. Clear Temporary Files Using the Command Prompt

You can also use the Command Prompt utility to clear the temporary files. Here’s how you can clear the temporary files using the Command Prompt utility on Windows.

1. Click on Windows 11 Search and type Command Prompt. Right-click on the Command Prompt and select Run as administrator.

Run as administratorRun as administrator

2. When the Command Prompt opens, execute the given command:

%SystemRoot%explorer.exe %temp%

execute the given commandexecute the given command

3. You can use the CTRL + A function to select all files. Once selected, you can delete it. Or else, execute the command to delete all temporary files.

del %temp%*.* /s /q

delete all temporary filesdelete all temporary files

4. Delete the Prefetch Files Using the Command Prompt

Prefetch files are temporary files you can delete to free up storage space. Here’s how to do so using the Command Prompt.

1. Open Command Prompt with admin rights (Right click > Run as administrator).

Run Command Prompt As an AdministratorRun Command Prompt As an Administrator

2. When the Command Prompt opens, execute this command:

%SystemRoot%explorer.exe C:Windowsprefetch

execute this commandexecute this command

3. Once done, execute this command to delete the Prefetch files:

del C:Windowsprefetch*.*/s/q

delete the Prefetch filesdelete the Prefetch files

This guide explains how to clean your Windows 10/11 PC via Command Prompt. I hope this article helped you! Please share it with your friends. If you have any doubts, let us know in the comment box below.

Source

 

Hey there! Just so you know, we’re an Amazon affiliate. This means if you buy something through our links, we may earn a small commission. It doesn’t cost you extra and helps keep our lights on. Thanks for supporting us!”

Avatar

Geeks Gadgets

About Author

Leave a comment

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

Productivity & Shortcuts

xbox parental control settings
How-To

How to set up parental controls on your Xbox Series X|S

Set parental controls for your children and have peace of mind when they’re gaming
image of laptop displaying the windows 11 2020 update on office desk
How-To

How to roll back Windows updates

We’ll show you how to roll back Windows updates in several ways.

Add A Knowledge Base Question !

You will receive an email when your question will be answered.

+ = Verify Human or Spambot ?