Operation did not complete successfully because the file contains a virus

When you try to access a file containing potentially harmful utility, the defense system safeguarding your computer will instantly stop the operation the file is trying to do. Within seconds of that, an error message will be visible on your screen stating – ‘Operation did not complete successfully because the file contains a virus‘. In almost all of the cases, the file may contain some malware that can damage the system files. But in case if this error message is showing up in all the cases, then there is a problem.


Fix 1 – Disable Windows Security briefly

If you are confident the file is 100% normal, you can disable Windows Security (or any other antivirus program) and check.

1. Type “Windows Security” in the search box.

2. Then, click on “Windows Security” to access it.


Windows Security Search Min


3.  Now, in the Windows Security window, click on “Virus & threat protection“.


Virus And Threat Protection Min


4. You need to click on the “Manage settings” of ‘Virus & threat protection settings’.


Manage Settins Min


5. In Virus & Threat protection settings, in the “Real-time protection” option, toggle it to “Off“.

6. Similarly, set the “Cloud-delivered protection” to “Off“.


Real Time Off Cloud Protection Off Min


Try to run the operation once more.

This will only disable some features of the Windows Security. To completely disable it follow any one of these methods –

Method 1 – Use registry editor 

1. Click on the Search box and then type “regedit“.

2. Now, click on “Registry Editor“.




3. You need to go to this location by expanding the left-hand side –

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender


4. Now, on the right-hand side, try to find the “DisableAntiSpyware” string value.

5. After that, just double click on “DisableAntiSpyware” to modify it.


Disable Double Click Min


6. After that, set the Value data: to “0“.

7. Click on “OK” to save the changes on your computer.


Disable Ok Min



Method 2 – Edit Group Policy

1. To access the Run window, press Windows key+R.

2. After that, type “gpedit.msc“. Click on “OK“.




3. Once the list of policies appears, navigate to this particular location-

Computer Configuration > Administrative Templates > Windows Components > Microsoft Defender Antivirus


4. After this,  double click on the “Turn Off Microsoft Defender Antivirus” policy to modify it.


Double Click Defender Antivirus Min


4. Set the settings to “Enabled“.

5. Finally, click on “Apply” and then click on “OK“.


Apply Ok Min



Windows Security safeguards your machine. Turning it off will make your device vulnerable to those threats. We suggest you turn the real-time protection “On” immediately after attempting the solution on your computer.


Fix 2 – Add the executable to the exception

You can add the application to the list of your antivirus exception.

NOTE– We have explained the steps in Windows Security for the Steam application. If you have a dedicated antivirus installed on your system, the steps will be similar.

1. At first, press Windows key+S and type ‘Windows Security‘.

2. Then, click on the “Windows Security“.


Windows Security Search Min


3. After that, click on the ‘home icon’  and then click on the “Virus & threat protection“.


Virus And Threat Protection Min


4. Scroll down in the Windows Security window to locate Virus & threat protection settings.

5. Then, click on the “Manage settings“.


Manage Settins Min


6. Click on the “Add or remove exclusions“.


Add Or Remove Min


7. Scroll down till you identify the ‘Exclusions‘ option. Click on the “Add an exclusion“.

8. From the drop-down select the “File” type.


Add An Exclusions


9. Now, navigate to the location where the application is installed on your computer.

10. Then, choose the exe file, and click on “Open“.


(Example – We want to exclude the Steam application from our system.)


Steam Exclusion Opne Min


11. You will notice that the application has appeared in the list of excluded applications.


Steam Exe Exclusion List Min


Close the Windows Security window.

Now, try to run the application again on your computer.


Fix 3 – Scan the Windows Explorer

You need to scan Windows Explorer to check and fix the problem.

1. Click on the search box and start to write “cmd“.

2. Further, right-click on the “Command Prompt” and click on “Run as administrators“.


Cmd Search New Min


3. Paste this code in the terminal. Thereafter, hit Enter to run the scan.

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


Sfc Explr 1


SFC scan will commence checking the Explorer.

4. To run the second scan, write this command in the CMD terminal and then hit Enter.

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


Sfc Explr 2


This will fix the issue.


Fix 4 – Clear out Windows backup settings

Some users have complained that Internet Explorer history can be causing this issue.

1. Press Windows key+R to open the Run window.

2. In the Run window, write “inetcpl.cpl“. Click on “OK“.


Win + R Run Command Search Inetcpl.cpl Ok


The Internet Properties window will open.

3. When the Internet Properties window appears, go to the “General” tab.

4. In the Browsing History section, click on “Delete“.


Delete Browsing History Min


5. In the next screen, uncheckPreserve Favorites website data“.

6. Then, check the next three options as “Temporary Internet files and website files“, “Cookies and website data“, and “History” data.

7. Next, click on “Delete” to delete the data from your computer.


Delete Browising Select And Dlete Min


Restart your computer and further try to run the operation again on your machine.


You can perform these optional steps to clear the browsing data from the Edge browser also.

1. Open the Edge browser on your machine.

2. When the Edge browser opens up, press the ‘Ctrl+Shift+Delete‘ keys together to access the Clear Browsing Data settings.

3. Select “All time” from the drop-down and click on “Clear Now“.


Delete Browsing Edge Min


This will clear the browsing data from your computer.


Fix 5 – Run the application in safe mode

If nothing is working out for you, try running the application in safe mode.

1. You have to open the Settings screen and click on “Update and Security“.


Update And Security


2. On the left-hand side, click on “Recovery“.

3. After that, under ‘Advanced Startup’, click on “Restart Now“.


Recovery Restart Now Min


4. Your device will boot into the Windows Recovery Environment. 

Once it does, simply click on “Advanced options“.


Troubleshoot Reset This Pc Advanced Options Startup Repair


5. Then you have to click on the “Startup Settings“.


5 Startup Repair Startup Settings


6. To restart your computer with special pre-defined conditions, click on “Restart“.


Startup Settings Restart Startup Repair


7. Once you are in the Startup settings, press the F5 key to “Enable Safe Mode with Networking“.


Safe Mode Networking


Your machine will boot into Safe Mode with networking.

Once it boots up, try to run the operation once more. If it works out, then there is some third-party application (generally, it is the antivirus or malware ) that is causing this problem. Uninstalling it from your computer may help.

Your problem should be solved.