If you enable files that are infected, they’ll infect the system. Therefore, the majority of anti-virus software such as Windows Defender wouldn’t permit opening a file or running any associated program if they believe that the program or file could be a trigger for an attack by a virus.
If this is the situation, you’ll get the error message stating: The operation was not completed successfully due to the fact that the file is containing an infection.
It’s possible for this message to be present even in programs that are known to.
In this scenario, it could be an alarm that is false. Anti-virus software treats every unknown outside file as a security risk. Let’s take examine possibilities to resolve it.
The operation was not completed successfully because the file is an infection
If you’re certain that the program or file that you are looking for is authentic then you can follow these solutions to overcome this error and perform the process:
- Disable Windows Defender Antivirus/Third-party Antivirus Program temporarily
- Add an exclusion to Windows Defender/Third-party Antivirus Program
- Repair File Explorer
- Run Disk Cleanup Tool.
I wrote this article assuming Windows Defender was the default antivirus program. Use the right solutions for your antivirus program of choice.
1. Disable Windows Defender/Third-party Antivirus Program
Although this issue can occur in any antivirus program, in the standard version, it’s more frequent for Windows Defender. To get around the issue you can turn off Windows Defender temporarily after having assessed the risk.
Click the Start button, then go into Settings, Updates, and Security. Click Windows Security. Choose Open Windows Security from the right-hand pane.
Click on Security for threats and viruses.
Under the threat and virus protection settings Click on the Manage Settings.
Switch off both real-time security as well as cloud-based protection.
Restart the system and then try running the program.
2. Add an exclusion to Windows Defender/Third-party antivirus programs.
Disabling antivirus is only a temporary fix. After you have confirmed the antivirus program, add the program’s executable to the list of exclusions.
Visit your Settings section to manage settings for Windows Defender as described in the previous paragraph. Click on the Exclusion section and then click to add or delete exclusions.
Click Add an Exclusion and then add the folder or file in the excluded area.
Try running the program or file after you’ve added the exclusion. verify if the exclusion works.
After you have completed your file, be sure you turn on your antivirus.
3. Repair File Explorer
If the issue is with a particular file that you’ve tried to access using the File Explorer, or the issue occurs while you use File Explorer itself, you might use the SFC commands to fix the problem with a single file.
Find Command Prompt in the Windows search bar. Right-click the option and choose Run as Administrator. Write the following command in succession and hit Enter after each command
If these actions solve the issue If they do, you’ll receive the following message ” Windows Resource Protection found corrupt files and successfully repaired them.” Restart your system.
This SFC option will scan and repair the file within the path specified. In our instance, we attempted to fix this issue by fixing the File Explorer itself.
4. Run Disk Cleanup Tool
There are numerous forums that suggest that temporary files are the cause of this error as well. This can be fixed through this Disk Cleanup Tool.
How can you stop an operation that did not go as planned because the file has viruses?
If the operation to disable it did not succeed due to the fact that the file has viruses and you need to for a short time, turn off Windows Defender.
If you’re absolutely certain it is legitimate and safe from viruses, you are able to skip this “Operation did not complete successfully because the file contains a virus” warning.
To do this it is necessary to briefly disable Windows Defender, and open the file with it disabled.