Home » Guides » Fix: 'Operation did not complete successfully because the file contains a Virus' Error (2023)

How to fix ‘Operation did not complete successfully because the file contains a Virus’ Error (2023)

Check out this guide to fix 'Operation did not complete successfully because the file contains a Virus' error.

When you try to open an installed app from an untrusted author, your Windows desktop gives an “Operation did not complete successfully because the file contains a Virus or Potentially unwanted software” error message. This might indicate the application might contain a malicious file that can affect your Windows desktop. However, if you know that the application is genuine, and it’s a false flag by the Windows firewall, this guide will help you to fix the error.

Fix: “Operation did not complete successfully because the file contains a Virus” Error (2023)

Fix Operation Did not complete successfully because the file contains a Virus' error

Before fixing the “Operation did not complete successfully because the file contains a Virus” error on your Windows desktop, ensure the file or application is virus free and run a full scan. Also, have a backup of your files before doing anything on your Windows PC. After you are sure that your system is not under any malicious threat, you can follow these methods to fix the issue:

1. Disable Windows Defender to fix the ‘Operation did not complete successfully’ error

  • Press the ‘Windows’ + ‘I’ keys on your keyboard to open the ‘Settings’ window.
  • Now click on the ‘Update and Security’ tab, then select the ‘Windows Security’ tab from the left panel.
  • Click the ‘Virus and Threat Protection’ tab and turn off all the toggles in the ‘Virus & Threat Protection’ app.
  • If the confirmation prompt appears, click the ‘Yes’ option.
  • Now restart your Windows desktop to disable the Virus warning error message.

2. Add the restricted file to Exclusion List

  • First copy the file path of the suspected application from File Explorer to Notepad.
  • Navigate to the ‘Virus & Threat Protection Settings’ window by following the above steps.
  • Under the ‘Exclusion’ section, click the ‘Add or remove exclusions’ hyperlink.
  • Click the ‘+ Add an exclusion’ button on the new window.
  • Select the file, program, or folder option, whichever is applicable, from the pop-up menu.
  • A new prompt window will open, here paste the file path on the text box that you copied to your Notepad.
  • Now click the ‘Open’ or ‘Add’ button.
  • Now check if the “Operation did not complete successfully because the file contains a Virus” error is fixed.

3. Repair File Explorer to fix the ‘Operation did not complete successfully’ error

  • Open the Command Prompt with administrative rights from the Start menu Search box and type the following commands:

sfc /SCANFILE=c:\windows\explorer.exe

sfc /SCANFILE=C:\Windows\SysWow64\explorer.exe

  • Make sure to press the ‘Enter’ key on your keyboard after typing each command.
  • If there are any issues with the File Explorer, System File Checker will fix it, and you will get a message like ‘Windows Resource Protection found corrupt files and successfully repaired them’, now restart your PC to fix the false Virus error message.

That’s everything covered on how to fix the “Operation did not complete successfully because the file contains a Virus” error. Also, check out our other guides, such as How to fix System error 6118 in CMD or How to fix Microsoft Office Error Code 30204-44.