Home » How To » How to Run Windows Defender from Command Line in Windows

How to Run Windows Defender from Command Line in Windows

You can run Windows Defender directly from command line. Here are all the useful commands and how to run them to scan your Windows system.

Windows Defender or also know as Windows Security is the default antivirus in Windows 10. Windows Defender runs silently in the background and provides real-time protection from all types of threats. When needed, you can launch Windows Defender and perform manual scan. This is useful when you want to do a quick system scan or scan a particular file, folder, or drive.

Along with the regular GUI (Graphical User Interface), Windows Defender also supports running from the command line. This is particularly helpful if you don’t want to launch Windows Defender every time you want to scan or if you want to create custom scripts. No matter the reason, if you ever need, use the below commands to run Windows Defender from Command Prompt.

Jump to command:

Commands to Run Windows Defender from Command Line

To run Windows Defender from the command line or Command Prompt, you need to have administrator privileges. Moreover, though there are a lot of commands to cover, we are only going to see the most useful ones. i.e, signature updates, full scan, quick scan, custom scan, and boot sector scan.

First, open Command Prompt as admin and execute the commands below as needed. To open the Command Prompt as admin, search for “cmd” in the start menu, right-click on the result and select “Run as administrator”.

Command to Update Windows Defender Signatures:

Before scanning the system, it is always advisable that you check for and update Windows Defender signatures. This ensures that Windows Defender is scanning with the latest virus signatures.

To update Windows Defender signatures via Command Prompt use the below command.

"%ProgramFiles%\Windows Defender\MpCmdRun.exe" -SignatureUpdate

If there are any signature updates available, they will be automatically downloaded and installed. Once done, you will see the “Signature update finished” message.

Windows-defender-command-line-signature-update

Note: You are only updating Windows Defender virus signatures, not the Windows Defender itself.

Quick Scan Command:

Quick scan in Windows Defender scans the most important places and files. This is useful if you want to check for most common threats and infections. Just copy the below command and execute it. Depending on your system, the quick scan will take few minutes to complete.

"%ProgramFiles%\Windows Defender\MpCmdRun.exe" -Scan -ScanType 1

Full Scan Command:

If you want to do a full system scan including all the files and folders in all drives, you can use the below command. Do keep in mind that depending on your hard drive size and number of files, the full scan will take quite a bit of time (in hours). Moreover, system resource usage will also be higher. This makes it harder for other intensive applications like Premiere or Photoshop to run slow.

"%ProgramFiles%\Windows Defender\MpCmdRun.exe" -Scan -ScanType 2

Command for Custom Scan:

Apart from the quick and full scan, you can also do a custom scan. This type of scan is useful when you want to scan a particular file or folder. In those kinds of cases, use the below command while replacing the dummy file or folder path with the actual path.

"%ProgramFiles%\Windows Defender\MpCmdRun.exe" -Scan -ScanType 3 -File "C:\FileOrFolderPath"

Boot Sector Scan Command:

If you suspect your boot sector is infected, you can use the below command to scan and remove any threats.

"%ProgramFiles%\Windows Defender\MpCmdRun.exe" -Scan -ScanType -BootSectorScan

That is all. It is that simple to run Windows defender from the Command Prompt or command line. As I said before, these are only the most useful commands. If you are interested, I suggest you check this Microsoft page for more commands and how to use them.

I hope that helps. If you are stuck or need some help, comment below and I will try to help as much as possible. If you like this article, do check out how to enable controlled folder access feature for ransomware protection and how to run Windows defender scan on schedule.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top