As a result, the computer goes slow and low disk space will appear.
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).
PC cleanup enables you to have abundant disk space and system resource.
If you dont know how to clean up your system, like read this post now.

Firstly, you gotta open Command Prompt with admin rights.
Step 1: In Windows 10/11, typecmdinto the search box.
Step 2: ClickRun as administratorfrom the popup to fire up the CMD window.

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

you could use the Scheduled Tasks tool to schedule the task to run at a specific time.
Lets see how to clean computer using CMD Cleanmgr.
Step 1: Open CMD with admin rights.

Step 2: TypeCleanmgrinto the CMD window and pressEnter.
Cleanmgr the command for disk cleanup, offers multiple parameters dedicated to specific functions, and lets see examples.
Cleanmgr /sagerun
This command doesnt choose the category and helps to automate the disk-cleaning process.
![]()
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/dchelps to delete all junk files quickly without the user prompt.
They are primarily to store, transfer data and recover lost data.

After finishing tasks, the system will automatically remove them from the temporary folders.
It is safe only when temp files are not used by any apps.
Or else, Windows will block you from deleting them with the result failing app tasks.
![]()
For temporary files created by Windows operating system, the storage path is%system%/windows/temp.
While for the temporary files created by the users, the path isC:\Users\username\AppData\Local\Temp.
If you want to view temporary files, run this command %SystemRoot%\explorer.exe %temp%.

This can pop fire up Temp folder in File Explorer.
Just pressCtrl + Ato choose all the files and delete them.
Or launch the command del %temp%*.
![]()
- /s /qto delete them.
The CMD tool can automatically skip any files that are currently in use but delete the rest files.
How to delete temporary files in Windows 11 to free up some disk space?
![]()
There are many ways for you to easily remove the temp files.
You dont need to defragment your SSDs since this may destroy them or reduce their lifespan.
Only defragment your HDDs by following the clean command in CMD defrag driver letter:.
![]()
Step 1: Open Command Prompt as an administrator.
Step 2: Typedefrag c:into the CMD window and pressEnter.
But they could take up much disk space.

This can launch the Prefetch folder in File Explorer.
Step 3: Typedel C:\Windows\prefetch*.
*/s/qand pressEnterto delete these prefetch files.

Alternatively, you’re free to directly delete the Prefetch folder from Windows Explorer.
However, if cache files go wrong, data fetching issues, glitches, or even crashes can happen.
A common solution is to clear cache files regularly.
![]()
you could choose to flush the DNS cache and Windows store cache.
If something goes wrong during the cache-clearing process, the Windows system will tell you.
To wipe the DNS cache, execute the command ipconfig/flushDNSin the CMD window.
To wipe the Windows store cache, execute this command wsreset.exe.
Do you know how to flush DNS on a Windows or a Mac computer?
In this post, we will show you how to do this job on different operating systems.
you might use DISM to manage a Windows image (.wim) and virtual hard disk (.vhd).
It is used forWindows Recovery Environment(WinRE),Windows PE, and Windows Setup.
To peek if there is any corruption, runDISM /online /Cleanup-Image /CheckHealthin the CMD window.
To scan the Windows image, execute this command DISM /Online /Cleanup-Image /ScanHealth.
To fix Windows images, typeDISM /Online /Cleanup-Image /RestoreHealthinto the CMD window and pressEnter.
Are you experiencing some annoying bugs or crashes when using your gear?
(Ultimate Guide & Tips).
During using Diskpart, you may choose an incorrect object.
As a result, data is lost and you cannot recover it.
So, it’s possible for you to’t be too careful.
Besides, we strongly recommend creating a backup for your important files.
How to clean C drive in Windows 11/10 if it is full of unnecessary files and programs?
Multiple methods can be found in this post to help you out.
Then, clickSet up backupand start a file backup by following the instructions on the screen.
Windows 10 Backup not working?
Importantly, it works although the PC fails to boot.
Just opt for following button to get its Trial Edition to free use for 30 days.
Step 2: Open this software and clickKeep Trialto continue.
Step 4: ClickBack Up NoworSync Nowto execute the backup task.
Clean Hard Drive via Diskpart
Next, it is time to use the clean command in CMD Diskpart.
See how to clean computer using CMD:
Step 1: In the CMD window, typediskpartand pressEnter.
Step 2: Typelist diskand pressEnter.
Step 3: Execute the command select disk n. N means the disk number.
If you see the disk status shows offline, typeonline diskand hitEnter.
Step 4: To wipe your hard drive, runcleanorclean all.
Is it safe to delete system junk files?
How to get rid of system junk files to release some space for new data?
you’re able to read this article to get the answers.
If you need, just run commands for cleaning PC by following the given guide.
Hope it’s possible for you to have a smooth PC.
If you have other ideas on cleanup commands, let us know in the Comment part below.