+4 votes
81 views
How to use SFC Scannow Command

in Windows11 by (552k points)
reopened | 81 views

1 Answer

+5 votes
Best answer

1 How to use SFC Scannow Online command
2 How to use SFC Scannow Offline command
3 How to use SFC Scannow command with manual repair

SFC (System File Checker - System File Checker) is a command integrated into Windows operating systems whose mission is to thoroughly examine Windows and restore corrupt files found in this process, this works directly with the NTFS file system which allows all operations in Windows 10 or 11 (especially read and write) to be executed accurately, an error in NTFS can be reflected in various ways in the behavior of the system or applications, basically SFC performs a scan and verification of the integrity of all protected system files and then replaces the incorrect versions with correct versions, thereby optimizing usage..

 

In the event that SFC detects that a protected file has been overwritten, it will take care of recovering the correct version of the file directly from the systemroot\ folder in order to replace said file, allowing its integrity.

 

SFC Syntax
The general SFC syntax is as follows:
 sfc [/scannow] [/verifyonly] [/scanfile=<file>] [/verifyfile=<file>] [/offwindir=<Windows offline directory> /offbootdir=<offline boot directory> /offlogfile=<path> 

 

 

SFC parameters
The parameters used have been:

 

  • /scannow: it is the most used parameter and is responsible for analyzing the integrity of all system files and repairs files with some type of error
  • /verifyonly: this parameter allows you to scan the integrity of all protected system files but does not perform any type of correction
  • /scanfile <file>: allows you to scan the integrity of the indicated file to repair the detected problems
  • /verifyfile <file>: performs a verification of the integrity of the file that we indicate without making any repair
  • /offwindir <offline Windows directory> - Specifies the location of the offline Windows directory to which offline repair will be done
  • /offbootdir <offline boot directory> – Indicates the location of the offline boot directory to which the offline repair will be done
  • /offlogfile=<log file path> – refers to the location where the log file will be stored

 


TechnoWikis will explain how to use SFC in various ways and for this we will use Windows 11.

 

To stay up to date, remember to subscribe to our YouTube channel!
SUBSCRIBE ON YOUTUBE

 

 


1 How to use SFC Scannow Online command

 

Step 1

This is one of the most common methods of using SFC, we open the Terminal as administrators:

 

image

 

Step 2

We accept the UAC permission:

 

image

 

Step 3

We execute:
 sfc /scannow 
image

 

Step 4

We wait for the process to finish:

 

image

 

step 5

In this case we can see that no error is detected, the message options that we can see will be the following:

 

  • Windows Resource Protection found no integrity violations: This message indicates that there is no missing or corrupted system file
  • Windows resource protection could not perform the requested operation: this message indicates an execution error, for its solution we run SFC again and additionally we check that the PendingDeletes and PendingRenames folders are created within %WinDir%\WinSxS\Temp
  • Windows Resource Protection found corrupted files and successfully repaired them: refers to some errors have been fixed and are located in the CBS.Log file in the path %WinDir%\Logs\CBS\CBS.log
  • Windows Resource Protection found damaged files, but could not fix some of them: indicates that not all the task was successful and we can see details in CBS.Log in the path %WinDir%\Logs\CBS\CBS.log

 

step 6

Now we open CMD as administrator.

 

image

 

step 7

We execute the following:
 findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log > C:\sfclogs.txt" 
image

 

step 8

With this we have created a text file to see the details of the CBS.Log file, we open the File Explorer and in the C drive we will see the file created:

 

image

 

step 9

It is possible to open it to see the SFC process:

 

image

 

step 10

There we find the following syntax:
  • Date and time of SFC execution
  • Datatype
  • ID of the parsed process
  • Process code
  • SR (System Recovery)
  • Operation details

 


2 How to use SFC Scannow Offline command

 

It is now possible to use SFC in offline mode which allows a full scan to be performed without interfering with active processes..

 

Step 1

For this method we are going to:
  • Beginning
  • Setting
  • System
  • Recovery

 

 

 

image

 

Step 2

There we will click on "Restart now":

 

image

 

Step 3

We will see the following message:

 

image

 

Step 4

Confirm the operation to start Windows in Advanced Mode:

 

image

 

step 5

We expect this mode to start:

 

image

 

step 6

Now we click on "Troubleshoot":

 

image

 

step 7

Then we click on "Advanced options":

 

image

 

step 8

Now we click on "Command Prompt":

 

image

 

 

step 9

We will have access to the command prompt console, there we access the disk utility:
 diskpart 
image

 

step 10

We list the volumes:
 list volume 
image
step 11

Consider the drive where Windows is installed (several gigs in size) and the reserved drive (a few megabytes in size).

 

We run the scan in offline mode:

 sfc /scannow /offbootdir=(reserved_letter):\ /offwindir=(Windows_letter):\Windows 
image

 

step 12

Wait for the process to finish:

 

image

 

step 13

We exit the terminal and click "Continue" to access Windows 11:

 

image

 

step 14

Windows will be started:

 

image

 


3 How to use SFC Scannow command with manual repair

 

Step 1

As administrators it is possible to manage the results of SFC to detect where the errors occur and thus be able to work directly on them, first of all, we open the File Explorer and in drive C we will see the SFC log file which we explain above how to generate:

 

image

 

Step 2

When opening it, it is possible to find the files with error:

 

image

 

Step 3

Now we open CMD as administrator:

 

image

 

Step 4

We take ownership of the failed file:
 takeown /f (file path) 
image

 

step 5

This will give the administrative ownership of the file in question, now we are going to execute the following to have full administrator access to the system file that presents the error:
 icacls (file path) /Grant Administrators:F 
image

 

step 6

Finally we are going to replace the damaged system file with a file that is in perfect condition, we execute the following:
 copy (source_path) (file path with error) 
step 7

We must confirm the process by entering the letter S:

 

 

 

image

 

This is how SFC will help us to examine the file system in its entirety and to be able to correct errors that affect the operability of the system.

 


by (3.5m points)
edited

Related questions

+4 votes
1 answer
+5 votes
1 answer
asked Dec 16, 2022 in Windows11 by backtothefuture (552k points) | 89 views
+3 votes
1 answer
asked Feb 6, 2023 in Linux/Unix by backtothefuture (552k points) | 81 views
+5 votes
1 answer
+3 votes
1 answer
asked Oct 20, 2020 in Linux / Unix by backtothefuture (552k points) | 240 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users