Activating a file that has a virus could infect your whole system. Therefore, antiviruses and Windows Defender don’t allow the system to open the file or run any associated programmes if an associated programme/ software can trigger a virus attack. In such a scenario, we encounter the error – Operation did not complete successfully because the file has a virus.
Possibly, this error can occur as a false alarm for known or trusted programmes. Antivirus products treat unverified and untrusted external files as a threat. Let’s check out some possible solutions to fix this issue.
Also Read: How to disable anti-virus in Windows 10?
Why does this happen?
There are a few possibilities for this to happen. Some of these could be:
- A file is affected by malware.
- A file or application downloaded from an unverified source.
- Downloaded software is flagged as dangerous by the antivirus because the code or behaviour matches that of known malware.
Some Common Fixes
You can try your hands on the below solutions as a fix for a file that you have downloaded from a legitimate website or one that has a trustworthy source.
Disable Windows Defender Temporarily
If you are sure that the downloaded file is genuine, you can temporarily disable the Windows Defender in your system to avoid the warning while opening the file. Repeat the steps to disable the Windows Defender.
Step 1: From the Start menu, click on the Settings button.
Step 2: Click on the Update & Security tile. All the security settings are available here.
Step 3: Choose the Windows Security tab and then click on Virus & threat Protection option. A Windows Security window will open.
Step 4: On the Windows Security screen, click on the Manage Settings link under the Virus & threat protection header.
Step 5: Finally, turn off the toggle bar against the Real-time protection and Cloud-delivered protection field for Windows.
Now, try opening the file while the Windows Defender is off temporarily. The warning will not display, and your file will open without issues.
Adding the File or Folder to the Exclusion List
To bypass the warning without switching off the Windows Defender or Antivirus, you can add the file or folder to an exclusion list. Then the system will not perform a suspicious search on the file or directory. Follow the below steps to find out how.
Step 1: Open File Explorer and go to the file location to be excluded from a suspicion check by the antivirus. Copy the path of the file from the address bar.
Step 2: In the same way as described in the above steps, open the Windows Security screen.
Step 3: Switch to the Virus & threat protection tab. A new page will be displayed. Now click on the Manage Settings button under the Virus & threat protection heading.
Step 4: Scroll to the end of the page to the Exclusions heading. Click on Add or Remove exclusions link. Your screen will redirect to a new page.
Step 5: A pop-up will be displayed to request the User Access Control. Click on the Yes button to approve the launch of the application with administrative permissions.
Step 6: Now click on the Add an Exclusion button. Choose the exclusion type from the drop-down based on the file or folder type you want to open. For example, choose the Folder option from the drop-down.
Step 7: Paste the file path in the name field. Click on the Select Folder button once done.
Once you’ve added the file or folder as an exclusion, you will be able to open it without getting any warning messages.
Repair the File Explorer
The warning message, “Operation did not complete successfully because the file contains a virus”, could show up because of a file Explorer problem. To repair the File Explorer, use the following SFC commands.
sfc /SCANFILE=c:\windows\explorer.exe sfc /SCANFILE=C:\Windows\SysWow64\explorer.exe
Step 1: Initially open the Command Prompt application from the Start menu in Administrative mode by choosing the Run as administrator mode.
Step 2: If prompted with a User Access Control (UAC) pop-up, click on the Yes button to launch the app with administrative permissions.
Step 3: Type in the above SFC commands in Command Prompt window in a sequence and press Enter.
Step 4: Finally, if these commands execute successfully, you will get a success message Windows Resource Protection found corrupt files and successfully repaired them. Otherwise, you will get a confirmation message stating there are no violations in your system.
In the final analysis, try to restart the system and see if the error resolves for the file path you provided in the Command Prompt window.
A Fix for Windows Backup
While other fixes might resolve your problem, sometimes the error message might show up because of the storage of temporary internet files and cache in the backup. There’s an easy resolution to fix this issue.
Step 1: In the search panel of the Start bar, type in Control Panel. Click open the first search result from the list.
Step 2: In the Control Panel window, click on the Network and Internet link.
Step 3: Once in Network and Internet section, click on the Internet Options option.
Step 4: In the pop-up window under the General tab, click on the Delete button under the Browsing History heading. A new window will open.
Step 5: Uncheck the checkbox against the Preserve Favourites Websites Data option.
Step 6: Similarly, check the given options and click on the Delete button.
- Cookies and website data
- History
- Download history
Step 7:ย Restart your computer and check if you can open the file without a warning message. If not, try to reset your browser and clear the browser data, cookies, and browsing history.
Run the Disk Cleanup Utility
In Windows 10, you often see the accumulation of temporary files and folders, which causes computer problems and may lead to misleading errors. You can delete these files and folders using Disk Clean-up Utility to save space and fix the system problems.
Step 1: Launch the Disk Clean-up utility from the Search menu.
Step 2: Select the Windows System Drive from the dropdown menu and click the OK button. Usually, the system is pre-installed on the C Drive.
Step 3: A new Disk Clean-up for C Drive will come up. The space taken up by the temporary files is displayed. Select the Temporary Internet Files and Temporary Files check box. Additionally, you could delete other junk files such as DirectX Shader Cache or Thumbnails.
Step 4: Once you’ve selected the files for removal, click on the OK button.
Step 5: Further on the confirmation pop-up that appears, click on the Delete Files button. The process to remove temporary files will start and free up space on your disk.
A Thorough Antivirus Scan
The most recommended solution to avoid the warning is to run a complete system scan to ensure that there are no malicious files in your system. A system scan using an antivirus tool can detect any malware or virus attacks on your system. However, it is an individual’s choice to use either Windows Defender or a more focused third-party application to perform the search.
Step 1: Launch the Windows Security app.
Step 2: Switch to the Virus & threat protection tab. Click on the Scan Options link.
Step 3: Select the Full Scan option. A detailed scan runs to check every file on the system to ensure no underlying threats are present.
Step 4: Lastly, click on Scan Now button to begin the search. If the system detects any threats, it will automatically quarantine or remove the file.
Step 5: Once the scanning process starts, you will see the details such as estimated time and no. of files scanned on the screen.
Once the search is complete, you can view the scan results. If a file has any potential viruses, the system will dump it. You can opt to download another, more trustworthy file. Otherwise, your operation to run or open a file successfully will be successful.
Also Read: What is CTF Loader? Is it a virus?