Suppose you are a Windows user and have been working on your computer for a long time. You should keep cleaning our computers from time to time. In the background, there are lots of tasks going on on your PC. Because we install many programs on our computer, it quickly fills up the storage. Keeping your computer free from clutter can help improve performance and free up your PC memory.
In this blog, we are discussing how to clean your computer using cmd. There are several ways to clean your system memory. If you are using Windows 10 and 11, it comes with system junk cleaning utilities to free up storage space.
5 Ways to Clean Computer Using Command Prompt
We provide some methods that you can follow and clean your computer. So, follow the given below methods step by step and carefully.
- Run disk cleanup utility by CMD
- Clean temporary files by using the cleanup command
- Clear cache memory in your Windows computer
- Erase data from HDD using Diskpart Command
- Clear your hard disk by CMD
Method 1: Run disk cleanup utility by CMD
This method will run a disk cleanup utility to free up storage space. Follow the given command.
- Click on your Windows start button and type CMD.
- Right-click on the Command Prompt and then Select Run as Administrator.
- In the Command prompt, type cleanmgr and click on the enter button
- In the Cleanup Utility windows, select the drive which you want to clean and click the OK button
If you want to clean up the task automatically, there are two commands.
Cleanmgr/sageset
This command will skip the drive selection step. The format of running the sagerun command is below.
cleanmgr/ sageset: numeric_id
Cleanmgr/sagerun
This command helps you with the automatic disk cleaning without selecting the categories. Here is the format of running the sagerun command
cleanmgr/ sagerun: id
Method 2: Clean temporary files by using the cleanup command
Clean your computer’s temporary files by using the cleanup command. It is saved to delete temporary files. The temporary files, also called Temp created by OS, are stored in %system%windows/temp. When the users make temporary files, they will keep them in C:\Users\username\AppData\Local\Temp.
Temporary files using command prompt is
%SystemRoot%\explorer.exe %temp%\
To delete temporary files command is
del %tem%\*.*/s/q
Method 3: Clear cache memory in your Windows computer
Now, we are trying to clean your computer by clearing cache memory. You can quickly delete your computer’s DNS cache and windows store cache. Windows will notify you if there is an issue with deleting the cache files. So, follow the given steps.
- In the Windows search bar search command prompt
- Right-click on the command prompt and then click on Run as administrator
- Now, run this ‘ipconfig/flushDNS’ command prompt.
- After that, you will receive a message that the DNS cache is successfully cleared.
Or, if you want to clear windows store cache memory, use this WSReset command in the cmd.
Method 4: Erase data from HDD using Diskpart Command
This method can use the diskpart command line to clean or erase your HDD data. Diskpart is a command-line disk partitioning utility that is available from Windows 2000. Now, clean your HDD using diskpart command, then follow the given steps.
- Start the command prompt as administrator.
- Type diskpart command and click on the enter button
- Now, type ‘list disk’ in cmd.
- You can see all connected disks to your computer in the display with their availability status.
- Type select disk n
- If the disk status is offline, then type ‘online disk’ and press enter
- Now, type ‘clean’ or ‘clean all’ if you need
- At last, diskpart succeeded in cleaning the disk, and you can get this message.
Method 5: Clear your hard disk by CMD
In the last method, we will defragment the hard disk via CMD. This method helps you to clean all junk files stored on selected drives. Now, you can follow the procedures given below step by step.
- Open your Windows search bar and type CMD, and search
- Right-click on the command prompt and select Run as Administrator.
- On the command Prompt, copy and enter this ‘defrag c:’ command
Note: This command will defrag the C: drive of your PC. You can change the drive letter if you want to defrag any other drive.
- In the next step, the Disk Defragment tool will scan the selected drive and remove the junk and temporary files.
That’s it; We hope you can successfully clean your computer using the command prompt.
Leave a Reply