How to scan files manually for virus infection on Windows 11
If you're unsure about a file, you can scan it manually for malware infection, and here's how.
On Windows 11, the Microsoft Defender Antivirus provides real-time protection for malware (such as viruses, ransomware, spyware, and other types of attacks), but the security feature also offers an option to scan files (and folders) manually, and in this guide, I'll outline the different ways to complete this task.
While the anti-malware is constantly monitoring your system to detect and remove unwanted malicious code and hacker attacks automatically, sometimes, you may still want to check a specific file or folder manually to ensure they're free of viruses or anything harmful to your computer.
If you must manually scan different types of content, Microsoft Defender includes at least four different methods, including File Explorer, Windows Security, Command Prompt, and PowerShell.
In this how-to guide, I'll outline four ways to manually scan files for malware on Windows 11.
How to scan files manually with Microsoft Defender from File Explorer
To do a manual scan for a specific file or folder with the Microsoft Defender Antivirus on Windows 11, use these steps:
- Open File Explorer.
- Browse to the location containing the files and folder you want to scan.
- Select one or multiple items.
- Press and hold the Shift key, right-click the selection, and choose the "Scan with Microsoft Defender" option.
- Quick tip: You can always right-click the selection and click "Show more options."
Once you complete the steps, the Windows Security app will open on the "Virus & threat protection" page to view the scan result and additional information (if applicable).
How to scan files manually with Microsoft Defender from Windows Security
To scan files manually through Windows Security, use these steps:
Get the Windows Central Newsletter
All the latest news, reviews, and guides for Windows and Xbox diehards.
- Open Start.
- Search for Windows Security and click the top result to open the app.
- Click on Virus & threat protection.
- Click the Scan options setting.
- Select the Custom scan option.
- Click the Scan now button.
- Select the folder location with the files to scan.
- Click the Select Folder button.
After you complete the steps, the antivirus will scan the selected folder since you cannot choose a specific file.
How to scan files manually with Microsoft Defender from Command Prompt
To scan a specific file manually through Command Prompt, use these steps:
- Open Start.
- Search for Command Prompt, right-click the top result, and select the Run as administrator option.
- Type the following command to access the Platform folder and press Enter: cd c:\ProgramData\Microsoft\Windows Defender\Platform
- Type the following command to identify the latest version of the antivirus command tool and press Enter: dir
- Type the following command to access the folder with the latest version and press Enter: cd 4.18.24090.11-0
In the command, replace "4.18.24090.11-0" with the latest version of the folder available on your device.
- Type the following command to scan a specific folder and press Enter: mpcmdrun -Scan -ScanType 3 -File "C:\PATH\TO\FOLDER"
In the command, replace "C:\PATH\TO\FOLDER" with the path to the folder you want to scan. For example, this command scans all the contents in the "files" folder: mpcmdrun -Scan -ScanType 3 -File "C:\Users\USERNAME\Downloads\files"
- Quick note: You only need to use quotation marks if the path contains a space.
- Type the following command to scan a specific file and press Enter: mpcmdrun -Scan -ScanType 3 -File "C:\PATH\TO\FILE.TXT"
In the command, replace "C:\PATH\TO\FILE.TXT" with the path to the file you want to scan. For example, this command scans the file named "image.jpg" inside the "files" folder: mpcmdrun -Scan -ScanType 3 -File "C:\Users\USERNAME\Downloads\files\image.jpg"
Once you complete the steps, Microsoft Defender will scan and output the result of the scan. The files are not infected if you receive the "found no threats" message.
How to scan files manually with Microsoft Defender from PowerShell
To scan files manually from PowerShell, use these steps:
- Open Start.
- Search for PowerShell, right-click the top result, and select the Run as administrator option.
- Type the following command to scan a folder using Microsoft Defender Antivirus scan and press Enter: Start-MpScan -ScanType CustomScan -ScanPath "C:\PATH\TO\FOLDER"
In the command, make sure to replace "C:\PATH\TO\FOLDER" with the folder location you want to scan. For example, this command scans the "files" folder: Start-MpScan -ScanType CustomScan -ScanPath "C:\Users\USERNAME\Downloads\files"
- Type the following command to scan a file manually with Microsoft Defender and press Enter: Start-MpScan -ScanType CustomScan -ScanPath C:\PATH\TO\FOLDER\FILE.TXT
In the command, make sure to replace "C:\PATH\TO\FOLDER\FILE.TXT" with the path to the file you want to scan. For example, this command scans the file called "image-1.jpg" for threats: Start-MpScan -ScanType CustomScan -ScanPath "C:\Users\USERNAME\Downloads\files\image.jpg"
After you complete the steps, the antivirus will only scan the file you specified.
More resources
Find in-depth guides, troubleshooting tips, and the latest updates on Windows 11 and 10 here:
Mauro Huculak has been a Windows How-To Expert contributor for WindowsCentral.com for nearly a decade and has over 15 years of experience writing comprehensive guides. He also has an IT background and has achieved different professional certifications from Microsoft, Cisco, VMware, and CompTIA. He has been recognized as a Microsoft MVP for many years.
-
GraniteStateColin Wow, didn't know you could virus scan from PowerShell or the command prompt. I'm not sure I'll ever do it that way, but that's interesting and good to know if I ever want to script it.Reply
Thanks!