Storage Clear up commands
Storage Clear up commands
To clean up unnecessary files and scan for old versions of files that are not being used, you can
use several commands in Command Prompt (CMD) on Windows. Here are a few useful
commands to clean and optimize your system:
You can trigger the Disk Cleanup tool from the command line to remove unnecessary files.
cleanmgr
This command opens the Disk Cleanup utility. You can choose to clean system files, temporary
files, and other unneeded data.
To clean up files automatically without manually selecting options, you can run:
cleanmgr /sagerun:1
First, you would need to configure which types of files to delete by running:
cleanmgr /sageset:1
Then, select the types of files you want to delete (like system files, temporary files, etc.).
Sometimes, old Windows updates can take up space. You can use this command to remove
them:
del /s /q /f %windir%\SoftwareDistribution\Download\*.*
If you're concerned about outdated system files, you can use the System File Checker (SFC)
tool to scan and repair missing or corrupted system files.
sfc /scannow
If you suspect there are issues with your disk, use the following command to check for errors:
chkdsk C: /f
This checks the C drive for errors and attempts to fix them.
If you've recently upgraded Windows and the previous version is still present as a Windows.old
folder, you can remove it to free up space:
rd /s /q C:\Windows.old
If you want to delete old system restore points to free up space, you can use the following
command:
If you're running Windows 8 or later, you can use the DISM command to clean up system files:
This will remove old versions of system files that are no longer needed.
Summary of Commands: