Command Prompt showing administrator rights and commands for taking ownership and granting permissions to a system file
Command Prompt showing administrator rights and commands for taking ownership and granting permissions to a system file

How to Manually Replace Corrupted System Files in Windows

After identifying a corrupted system file from the log file that System File Checker couldn’t repair, you can manually replace it with a known good copy. This guide will walk you through the steps to take ownership, grant permissions, and replace the file using the command prompt.

Note: Obtain a known good copy of the system file from a computer running the same Windows version. Running System File Checker (SFC /scannow) on that computer beforehand ensures you have a clean copy.

Step 1: Take Administrative Ownership of the Corrupted System File

This step grants you control over the corrupted file, allowing you to modify it. Open Command Prompt as an administrator and type the command below, replacing with the actual path and filename of the corrupted file. Press ENTER to execute.

takeown /f <corrupted_file_path_and_name>

Example:

takeown /f C:windowssystem32jscript.dll

Step 2: Grant Administrators Full Access to the Corrupted System File

Now, you need to give administrators group full permissions to the file. Use the icacls command followed by the file path and the permission grant. Replace with the same path used in Step 1.

icacls <corrupted_file_path_and_name> /grant administrators:F

Example:

icacls C:windowssystem32jscript.dll /grant administrators:F

Command Prompt showing administrator rights and commands for taking ownership and granting permissions to a system fileCommand Prompt showing administrator rights and commands for taking ownership and granting permissions to a system file

Step 3: Replace the Corrupted System File with a Known Good Copy

With ownership and permissions configured, you can now replace the corrupted file. Use the copy command. Replace with the path to the good copy of the file and with the path to the corrupted file (same as in previous steps).

copy <path_to_good_file> <corrupted_file_path_and_name>

Example:

copy E:tempjscript.dll C:windowssystem32jscript.dll

If these steps do not resolve the issue, reinstalling Windows might be necessary. Refer to Recovery options in Windows for further assistance.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

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