We've all been there: Something is wrong with our Windows installation. It may be a broken feature or software that used to open that does not open anymore. We start wondering: Should we re-install windows or wait? Re-installing is the most comprehensive solution, but a lot of work and may not fix the problem.
An intermediate solution I've used a couple of times to fix small to medium problems with windows installations is to run two windows commands from an administrative command window. This has fixed the problems I had with windows on a couple of occasions (not all though), meaning I didn't need to even consider re-installing Windows afterwards. I'll even run it every couple of weeks as a preventative measure.
The short version of the check-and-repair process is to open an administrator command window, then run the following two commands in it:
sfc /scannow
dism /online /cleanup-image /restorehealth
It should complete in a couple of minutes, depending on the speed of your drive.
If you're like me and want to understand a bit more about what we're doing and why, a brief explanation is provided below.
The first program we run is called SFC (System File Checker). Run "sfc /?" to request the help for the SFC program, run "SFC /?":
To use it, run "sfc /scannow" and wait a minute or so for the check to complete:
If there were no issues with wrong / broken files, it should respond with the message shown above: "Windows Resource Protection did not find any integrity violations".
If there were any issues, it will respond with a different message. In this case, run the "sfc /scannow" command again. It should now respond that no integrity violations were found.
The second command to run is a bit more difficult to explain. Oversimplified, we're checking that the windows image is OK. The windows image is the combination of files and settings required to define what is needed for windows to run during startup. To check (and repair if needed), we use a program called "DISM". Running it from an administrator command window without arguments shows what the program is used for:
To check (and repair if needed) the windows image, run "dism /online /cleanup-image /restorehealth":
Unfortunately, it does not tell us whether issues were found and fixed, only that it ran successfully.
Afterwards, reboot the PC and see if the problem persists.