The Windows Defender is the default anti-malware tool by Microsoft. It’s an easy-to-use utility with advanced real-time protection that protects your device from viruses and malware.
Although you can operate the antivirus by using the Windows security app, most times using the command prompt to manage the antivirus is also important.
We are going to run through some common tasks that can be performed via the command prompt.
1. Run a Quick Virus Scan
Running a quick scan with Windows Defender via Command Prompt is quite easy. The antimalware tool will go through your PC in places such as start-up folders and registry keys in search of viruses and malware. It only takes a few minutes to run a complete scan on your PC.
Head to your search bar and search for Command Prompt, right-click and select Run as administrator.
Click Yes when the user access control (UAC) prompt pops up on the screen. To run a quick scan you type the following in your command prompt, paste the following in the command prompt window
"%ProgramFiles%\Windows Defender\MpCmdRun.exe" -Scan -ScanType 1
The scan progress will begin and you will be notified when it is completed.
2. Run a Full Virus Scan
When you run a full scan, Windows Defender will conduct an in-depth scan of your PC to detect viruses or malware. This takes a bit longer than a quick scan, depending on the total number of files on your computer.
To perform this scan, paste the following command and press Enter:
"%ProgramFiles%\Windows Defender\MpCmdRun.exe" -Scan -ScanType 2
3. Perform a Custom Virus Scan
You can also initiate Windows Defender via Command Prompt to perform a custom scan of a specific folder for viruses, malware, and other threats. This can also be executed on external storages like your flash drives or hard drives.
To execute this, type the following command and press Enter.
"%ProgramFiles%\Windows Defender\MpCmdRun.exe" -Scan -ScanType 3 -File "D:\Folder\Path"
The D:\Folder\Path represents the path to the folder you intend to scan. For instance, you can type the following command if you want to scan the documents in your Downloads folder.
"%ProgramFiles%\Windows Defender\MpCmdRun.exe" -Scan -ScanType 3 -File C:\Users\HP\Downloads
4. Scan Your PC’s Boot Sector Files
information on how your system starts its boot process is stored in the boot sector files; it contains strings of codes that boot up your PC. When the boot sector is infected, it affects your system’s booting process. Scanning these files for virus and malware is important.
To scan the boot sector files type the following command.
"%ProgramFiles%\Windows Defender\MpCmdRun.exe" -Scan -ScanType -BootSectorScan
5. Restore Quarantined Files
A quarantined file is a file that is found wanting by the Microsoft Defender. This file has already been scanned and moved to quarantine by the antivirus. If a file is mistakenly moved to quarantine, you can easily restore these files.
To list the quarantined files you can type the following command.
"%ProgramFiles%\Windows Defender\MpCmdRun.exe" -Restore -ListAll
You can note the name of the file you want to restore from the quarantined list and press the command below.
"%ProgramFiles%\Windows Defender\MpCmdRun.exe" -Restore -Name "FileName"
Replace FileName with the file that you intend to restore.
6. Update Microsoft Defender Antivirus
The Microsoft Defender regularly updates itself automatically to detect the latest virus and malware. However, you can also update it yourself by using the following command.
"%ProgramFiles%\Windows Defender\MpCmdRun.exe" -SignatureUpdate
Windows Defender can be used in real-time and via command prompt; it is straightforward and easy to use. Always remember to run your command prompt with administrative privilege. Let us know if you have any questions.