Windows PC slows down over time, and the main reason for this is unnecessary files, cache, and junk data. If you want to keep your system fast and clean without any third-party software, then CMD (Command Prompt) is a powerful tool. In this article, we will explain in detail how to clean a Windows PC with CMD and improve its performance.
What is CMD, and why use it?
CMD (Command Prompt) is an inbuilt command line interface in the Windows operating system, which allows advanced users to communicate directly with the system. This allows you to perform a variety of maintenance and optimization tasks without a GUI.
Preliminary Preparations to Clean Windows with CMD
Make sure you are running CMD as Administrator.
Save all files and applications, as some commands may restart the system.
Keep the network connection on, so that Windows Updates-related commands also work properly.
1. Deleting Temporary Files – Using `cleanmgr` and `del` Command
Temporary files can slow down the system’s speed. To delete them:
Command to run Disk Cleanup:
“`
cleanmgr
“`
This will open a GUI tool from which you can delete temporary files, thumbnails, Recycle Bin, etc.
Command to delete Temp Files from Direct CMD:
“`
del /q/f/s %TEMP%\*
rd /s /q %TEMP%
“`
This command will delete all unnecessary files from the TEMP folder.
2. Cleaning Prefetch Folder – Make System Boot Faster
Files stored in Prefetch can affect boot time.
“`
del /q/f/s C:\Windows\Prefetch\*
“`
After this, restart the computer.
3. Emptying the Recycle Bin
Files lying in the Recycle Bin take up space on the hard drive.
“`
rd /s /q C:\$Recycle.bin
“`
This command will clean the Recycle Bin of all users.
4. Clearing Windows Store Cache
If your Microsoft Store is not working properly, clear the cache:
“`
wsreset.exe
“`
This command will clear the cache of the Windows Store, and the store will open automatically.
5. Clearing DNS Cache – Make Browsing Faster
“`
ipconfig /flushdns
“`
This command deletes the DNS records saved in your system and refreshes the new DNS queries.
6. Running System File Checker – Repair Corrupted Files
“`
sfc /scannow
“`
This command checks the system files and if any file is found corrupt, it repairs it.
7. Removing Windows Update Cache
Old and incomplete update files can slow down the system.
“`
net stop wuauserv
net stop bits
rd /s /q C:\Windows\SoftwareDistribution
net start wuauserv
net start bits
“`
This step removes the cached files associated with Windows Update and then restarts the services.
8. Removing Log Files – Free Up System Space
“`
del /f /s /q %systemroot%\Logs\*
“`
System Logs can sometimes take up GBs of storage. You can clear them with this command.
9. Disabling Startup Apps (from Msconfig)
Although this cannot be done directly from CMD, you can open the Task Manager:
“`
taskmgr
“`
Then go to the Startup tab and disable unnecessary programs.
10. Disk Checking and Optimization – `chkdsk` and `defrag`
Checking disk errors:
“`
chkdsk C: /f /r
“`
This command will fix drive errors on the next boot.
Fragmenting the disk:
“`
defrag C: /O
“`
This optimizes the drive and arranges files in a better way.
11. Resetting the network with the Netsh Utility
If the network is slow, try these commands:
“`
netsh int ip reset
netsh winsock reset
“`
After this, restart the system.
12. Running the Windows Performance Diagnostics tool
“`
perfmon /report
“`
This generates a Performance Diagnostic Report that gives you a detailed description of system issues.
Conclusion – Why PC Cleaning with CMD is Important
With the help of CMD commands, you can clean your Windows PC without any third-party apps and increase its performance to a great extent. Follow all the above steps regularly, and your system will always be fast and responsive.
Want to grow your website organically? Contact us now
Frequently Asked Questions (FAQ) – About cleaning a Windows PC with CMD
Q.1: Is it safe to clean Windows with CMD?
Answer: Yes, if you use the commands correctly and in Administrator mode, it is completely safe. We use only those commands that are already authorized in Windows.
Q.2: What will happen if you delete temporary files from the CMD?
Answer: Deleting temporary files frees up disk space and improves system performance. It does not affect your data or important files.
Q.3: Why is it necessary to clean the Prefetch folder?
Answer: Old and unnecessary files accumulate in the Prefetch folder over time, which can slow down the boot speed. Removing them from time to time makes the system faster.
Q.4: What does `sfc /scannow` do?
Answer: This command scans all system files, and if any file is found corrupt, it replaces it with the original file of Windows.
Q.5: What is the use of `ipconfig /flushdns`?
Answer: This command clears the DNS Cache, so that the browser’s DNS queries are updated with new information. This increases the browsing speed.
Q.6: Will there be any harm if you remove the Windows Update Cache?
Answer: No, it does not cause any harm. It only removes old and incomplete updates so that new updates can be installed smoothly.
Q.7: Do all these CMD commands work on both Windows 10 and 11?
Answer: Yes, most of these commands work in both Windows 10 and Windows 11. However, some commands may depend on the version of Windows.
Q.8: At what interval should cleaning be done with CMD?
Answer: You should follow this process once a month. If you are a heavy user (like gaming, video editing, etc.), then you can do it every 15 days.