TL;DR
Yes, a file that has been opened and read can still contain a virus. Opening a file doesn’t automatically remove malicious code. You need to scan it with up-to-date antivirus software.
Understanding the Risk
When you open a file (like a document, image, or program), your computer reads its contents and executes instructions if it’s an executable file. However, this process doesn’t necessarily mean the virus is activated or removed. The virus remains part of the file until specifically dealt with.
Steps to Check for Viruses After Opening a File
- Update Your Antivirus Software: Before doing anything else, make sure your antivirus program has the latest definitions. This ensures it can recognise the newest threats.
- Most antivirus programs update automatically, but you can usually force an update manually.
- For example, in Windows Security (built-in), go to Virus & threat protection and click Check for updates.
- Run a Full System Scan: A full scan checks all files on your computer, including the one you just opened.
- In Windows Security, select Scan options and choose Full scan.
- Other antivirus programs will have similar options – look for ‘Full Scan’ or ‘Deep Scan’.
- Run a Targeted Scan: If you’re concerned about the specific file, scan it directly.
- Right-click on the file in File Explorer.
- Select Scan with Microsoft Defender (or your antivirus program’s equivalent).
- Check Quarantine: After a scan, your antivirus might move infected files to a ‘Quarantine’ folder.
- In Windows Security, go to Virus & threat protection and click on Protection history. Then select Quarantined items.
- Review the quarantined files carefully before deleting them permanently. Sometimes legitimate files are incorrectly flagged as threats (false positives).
- Use a Second Opinion Scanner: Sometimes, one antivirus program misses something. Consider using an online or standalone scanner for a second check.
- Examples include VirusTotal (https://www.virustotal.com/gui/home/upload) which scans files with multiple antivirus engines.
What if the File is an Executable (.exe, .bat, etc.)?
Executable files are more dangerous because they contain instructions that can be run immediately. If you suspect a malicious executable file:
- Do not run it again!
- Run a full system scan as described above.
- Consider using a virtual machine (VM) to safely analyse the file if you are technically confident. A VM isolates the file from your main operating system.
What about Office Documents (.doc, .xls, etc.)?
Office documents can also contain viruses through macros or embedded objects.
- Disable Macros: By default, Microsoft Office disables macros in downloaded files. Keep this setting enabled!
- If you must enable macros (only do so for trusted sources), scan the document thoroughly before and after opening it.
Command Line Scanning Example
Some antivirus programs offer command-line scanning options.
clamscan -r /path/to/file
(This example uses ClamAV, a free open-source antivirus engine. Replace /path/to/file with the actual file path.)
Preventative Measures
- Be Careful What You Download: Only download files from trusted sources.
- Don’t Open Suspicious Attachments: Avoid opening email attachments from unknown senders or if the subject seems unusual.
- Keep Your Operating System Updated: Security updates patch vulnerabilities that viruses can exploit.

