How to clean computer using CMD if you find the PC runs slowly with low disk space? You come to the right place and you can find out how to run commands for cleaning PC from this post on the MiniTool website to free up disk space and improve the PC performance.

It Is Necessary to Clean Computer

Windows operating system is a popular system and you can use many features on the PC running Windows. But as time goes on, many background tasks run to take up many system resources, and temporary files are created to take up disk space although these files are small. As a result, the computer goes slow and low disk space will appear.

In this case, you need to clean your computer regularly to speed up the machine and improve the PC's performance. Disk cleaning can let your PC work smoothly and eliminate some issues that cause the PC to crash.

Windows comes with some cleaning tools like Disk Cleanup, defragment tool, etc. But some of you choose to clean computer using CMD (Command Prompt). Although a graphical interface is handy for most people, some of you may prefer to use Command Prompt to do many tasks since it is more efficient, fun, and really powerful and brings performance benefits.

If you don’t know how to run commands for cleaning PC, follow the given guide to clean computer including deleting unwanted files, temp files, & prefetch files, defragging your hard drive, erasing a disk, and more.

How to Clean up Your Computer? Top 8 Methods for You
How to Clean up Your Computer? Top 8 Methods for You

PC cleanup enables you to have abundant disk space and system resource. If you don’t know how to clean up your computer, please read this post now.

Read More

How to Clean Computer Using CMD

In this part, we will show you how to use different commands to clean different files. Firstly, you need to open Command Prompt with admin rights.

Step 1: In Windows 10/11, type cmd into the search box.

Step 2: Click Run as administrator from the popup to open the CMD window.

run CMD as administrator

In addition to this way, you can open Command Prompt in other methods and refer to this related post - How to Open Command Prompt (CMD) in Windows 11? (7 Ways) .

Next, perform the cleaning operation via some clean commands in CMD.

Run Cleanmgr to Clean Unwanted Files

Cleanmgr is an automating disk cleanup tool in Windows operating system. It can search and analyze your hard drive to find files that are no longer needed and delete them automatically to free up disk space on the hard drive.

By configuring cleanmgr.exe with command-line switches, temp setup files, Internet files, downloaded programs files, old chkdsk files, Recycle Bin files and more can be deleted. You can use the Scheduled Tasks tool to schedule the task to run at a specific time.

Let’s see how to clean computer using CMD - Cleanmgr.

Step 1: Open CMD with admin rights.

Step 2: Type Cleanmgr into the CMD window and press Enter .

Step 3: A small window pops up to ask you to choose the drive you want to clean up. Then, click OK .

cleanmgr command

Step 4: Check the items you want to delete and then this tool will delete them to free up disk space.

Cleanmgr - the command for disk cleanup, offers multiple parameters dedicated to specific functions, and let’s see examples.

1. Cleanmgr /sageset

This command for disk cleanup helps to directly skip the selection of the drive and redirect you to the Disk Cleanup Settings window to choose the items you want Disk Cleanup to automatically clean up during its scheduled run times.

Cleanmgr /sageset

2. Cleanmgr /sagerun

This command doesn’t choose the category and helps to automate the disk-cleaning process.

3. Cleanmgr /lowdisk

This command is very useful when the hard drive meets low disk space. When running this command, all checkboxes of file categories will be selected by default. The command example is like – cleanmgr /lowdisk/dc . Here c refers to the drive letter.

The command - cleanmgr /verylowdisk/dc helps to delete all junk files quickly without the user prompt.

To know more information about this clean manager, you can refer to our previous post - What Is Cleanmgr.exe & Is It Safe & How to Use It .