Basic clean-up, check-up and repair of windows
Author: Sysnative Moderator xilolee
Preamble:
Read More:
All commands should be used from an elevated command prompt, i.e. with administrator rights.
Windows xp main user was usually an administrator (IIRC).
From windows vista onwards, you need to perform a special sequence to open an elevated command prompt, even in an administrator account.
The simpler method that should work for all windows versions (I didn't tried with xp ) should be: click windows start, in the searchbox type cmd, press and hold ctrl and shift keys, press enter, release all keys, respond yes to the user account control window that should appear (from vista onwards).
Windows xp main user was usually an administrator (IIRC).
From windows vista onwards, you need to perform a special sequence to open an elevated command prompt, even in an administrator account.
The simpler method that should work for all windows versions (I didn't tried with xp ) should be: click windows start, in the searchbox type cmd, press and hold ctrl and shift keys, press enter, release all keys, respond yes to the user account control window that should appear (from vista onwards).
You will find here a brief panoramic of windows tools that allow you to perform a basic clean-up, check-up and repair of your machine.
- Cleanmgr (Clean manager?)
(Command available since windows 2000)Read More:Also known as Disk Cleanup (its GUI version), this tool exists since windows 2000 (at least) and its aim is to remove unnecessary files from your drives.
You can run it anytime you desire. In the command prompt, typeCode:cleanmgr /sageset:1
I'd select them all, but you can choose to avoid some options.
To start the cleanup, you need to launch this other command:Code:cleanmgr /sagerun:1
The sageset/sagerun options allow up to 65535 combinations and their aim is to be used in a scheduled task, that should be run with the highest privileges.Read More: - Windows 10 Storage Sense
(Command available since windows 10 version 1709)Read More:This is the new tool to remove unnecessary files on windows 10 machines only.
It seems it is available since Windows 10 Fall Creators Update - Windows 10 version 1709 (2017 September = 1709) - Redstone 3 - 10 version 1709 build 16299.
With Windows 10 October 2018 Update - Windows 10 version 1809 (2018 September = 1809) - Redstone 5 - 10 version 1809 build 17763, the cleanmgr tool is declared as deprecated (abandoned).
You can find it in settings, system, storage, free up space now: windows will scan the drive and you will choose what items have to be deleted.
It is also possible to make it run automatically on its own, changing the sliding bar under storage sense from off to on; and change some basic settings about it in Change how we free up space automatically.Read More: - DISM - reduce the winsxs folder
(DISM = Deployment Image Servicing and Management)
(Switches available from Windows 8 onwards)Read More:The DISM application can be used to reduce the winsxs folder.
You can run it after an important windows upgrade, after cleanmgr.
You can also do a previous analysis with this command:Code:dism /online /cleanup-image /AnalyzeComponentStore
Code:dism /online /cleanup-image /startcomponentcleanup
Code:dism /online /cleanup-image /startcomponentcleanup /resetbase
- DISM - check, scan, restore the health of your OS
(switches available from Windows 8 onwards)Read More:The following command lasts a few of seconds (or even less) and check your OS health:Code:Dism /Online /Cleanup-Image /CheckHealth
- healthy: "No component store corruption detected."
- repairable: "The component store is repairable."
- non-repairable: "The component store is not repairable." (I'm not sure if this is the exact error message)
The following command lasts some tenth of minutes and scan your OS health (without trying a repair):Code:Dism /Online /Cleanup-Image /ScanHealth
Code:Dism /Online /Cleanup-Image /RestoreHealth
- SFC (System File Checker)
(Command available since windows 98)Read More:This tool allows you to "scan Windows and restore your files" (quoted from Microsoft webpage about sfc).
Launch the following command and windows will check and eventually will repair system files:Code:sfc /scannow
Otherwise, post a new topic in our windows update sub-forum and the windows update experts will help you to fix the corrupted files. - DEFRAG (Defragmenter)
(Command available since windows 95)Read More:This command sorts the files in your drives.
You'll rarely should use this command given that windows (since Vista) automatically defrag each partitions every week.
You might use it when you feel slowdowns in your machine (it is "sluggish"), after you used the previous tools.
It changed from windows xp to windows 10; currently, the following command works (for sure) in windows 10:Code:defrag c: /h
- CHKDSK (Check Disk)
(Command available since DOS)Read More:Some years ago (circa, in DOS era up to Win2000 era), a partition and a disk were almost the same thing.
But now, it checks the partitions.
You might use it after the defragmenter, when you perceive that there are problems in your machine.
Launch the following command and windows will check and eventually will repair the partition inconsistencies:Code:chkdsk c: /b
I.e., /f and /r switches are implied by the /b switch.
It will ask to reboot the machine (to start, run and complete this check).