Sfc (System File Checker) command

Deepak Gupta December 7, 2021
Updated 2021/12/07 at 11:16 PM

Windows command line or CMD It is a very useful tool to access system functions. While all of these functions can be performed through a graphical interface, the CMD is sometimes a more direct and convenient way to perform these functions. One of the functions that we can use from the CMD is the SFC command. If you want to know the details and utilities that this command provides, we invite you to continue reading. We already started.

What is the sfc command

The SFC command provides access to the System File Checker tool. As its name implies, this command is used to check if the files of the Windows operating system are damaged, blocked or if they have any other problem. Any type of damage to a critical system file can lead to a malfunction of the operating system. For this reason, this command is very useful to be able to recover these damaged files without having to completely reinstall the operating system.

Windows versions that have the sfc command

This command is available from the Windows Vista edition. Although few people currently use older versions of the Windows operating system, it is important that you know which versions you can use.

The SFC command is available in versions of Windows Vista Enterprise 64-bit Edition, Ultimate 64-bit Edition, Business, Business 64-bit Edition, Enterprise and Ultimate.

On the other hand, we can also make use of the command in the versions of Windows 7 Enterprise, Home Basic, Home Premium, Professional, Starter and Ultimate.

In addition, it is available in versions of Windows 8, Enterprise and Pro. Also in the versions 8.1, 8.1 Enterprise and 8.1 Pro. In addition, we can use them in Windows 10.

When to use sfc

It is necessary to use this command when some Windows functionalities they do not run correctly or directly do not work. Also, if the operating system freezes easily, it may be time to use the command as well. While it may seem cumbersome to use the command, if you follow the steps in order and one by one, there should be no problem solving the problem.

In order to use the command sfc, the first thing is to open the Windows command line in administrator mode (Windows 10 is used in the example). You can do them from the start menu, press the Windows key on the keyboard and type cmd. In the options that appear select “Run as administrator”.

Get files to repair damage

As initial condition it is necessary have an image of the operating system available. If you have internet access, make sure that the Windows Update function is enabled, this will allow the command to download the files from the web and replace the damaged ones. Using this path, type in the cmd with administrator privileges the command:

DISM.exe /Online /Cleanup-image /Restorehealth

This command takes care of mount a System image from the web to be able to carry out the checks. If you do not have an internet connection, you can use a system image contained in any removable device or somewhere inside the internal disk of the computer. To use this variant type the command:

DISM.exe /Online /Cleanup-Image /RestoreHealth /Source:<<path>>  /LimitAccess

In this case you must replace the marker <> by the path where the system image that you are going to use for the repair is located.

Run the sfc command

At CMD in administrator mode type the following command and then hit ENTER:

sfc / scannow

This command will perform a check of all protected files on the system. In case of finding any damaged, it will try to replace it with a copy of the system itself. These copies of the original files and without any damage are saved in a compressed which is in the directory % WinDir% System32 dllcache. In this case the marker % WinDir% refers to the directory where the operating system is located, usually c: Windows.

A Once the command is executed, you will see a percentage counter that indicates the percentage of the files being checked. It is important do not close this window until you have finished the whole process.

Running the sfc command.

Execution outputs of the sfc command

Once the file checking process is finished, you may find three different messages. These will tell you the check result. In some cases it is impossible to replace some files and it is necessary to carry out other actions.

Checking process without errors

The console may display the message “Windows Resource Protection did not find any integrity violations.” This means that no files are missing from the system or that no corrupted files were found.

In this case you just have to close the cmd and continue working with your operating system without any problem.

Permissions Denied for the sfc Command

If the message obtained after executing the command is “Windows Resource Protection could not perform the requested operation”, has to start the system in safe mode and run the process again from the beginning.

To run the system in safe mode, restart your computer. After the computer is restarting, and before the Windows logo appears on the screen, press the F8 key. If the Windows logo appears, you must restart the computer again and press F8 until the Windows advanced boot options appear. Then select the option “Secure mode with system symbol” and press ENTER. Once inside the system in safe mode, open the cmd as administrator and run the command again

sfc /scannow.

Correct check and repair of corrupted files

The message “Windows Resource Protection found corrupted files and repaired them successfully. Details are included in CBS.Log% WinDir% Logs CBS CBS.log ” reports the successful execution of the command. This means that during the file system check, corrupted files were found and these were successfully replaced. In addition, it provides us with a log where it informs details of the process.

To access and analyze the information in this log, it is recommended to move the content to another text file. To carry out this action, type in the cmd in administrator mode the command:

findstr /c:"[SR]" %windir%LogsCBSCBS.log >"%userprofile%Desktopsfcdetails.txt"

Replace the pointer % windir% by the root folder of the operating system, and % userprofile% by the folder corresponding to your user in the system.

This action will copy the content of the file CBS.log to the file sfcdetails.txt, the latter contains information on all executions of the sfc command. To locate yourself in a specific execution, look at the time and date of the entries in the log.

Open the file sfcdetails.txt on the desktop to view the details of the files replaced or repaired by the command.

Unable to repair files

If the SFC command output message says “Windows Resource Protection found corrupted files, but could not correct some of them. Details are included in CBS.Log% WinDir% Logs CBS CBS.log ” it means that some damaged file found cannot be repaired.

You can replace these files manually. First, you should check the details of the files that could not be repaired or replaced. To do this, check the execution log following the steps described above. Once you have knowledge of the files that cannot be repaired and their path, enter the following command.

takeown /f  <<path>><<file>>

This command will give you the administrative property on the file. Next, you need to assign full admin privilege access to the corrupted file. For this run the command:

icacls <<path>><<file>> /GRANT ADMINISTRATORS:F

Finally, you must replace the corrupted file with a non-corrupted version that you have in your possession. For this type the following command:

Copy archivoOrigen archivoDestino

In this case, you must replace source file by the full directory where the uncorrupted file is located, and fileDestiny for the full directory where the problem file is located.

Conclusions.

You can correct operating system malfunctions using the sfc command. If you follow the steps outlined above, you should have no problem using this very useful tool provided by Windows. However, if you cannot eliminate the problem, or the command does not work correctly, the serial solution may completely reinstall the operating system.


Share this Article
Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Thumbnails managed by ThumbPress