قالب وردپرس درنا توس
Home / Tips and Tricks / How to Use Microsoft Defender Antivirus from Command Prompt on Windows 10

How to Use Microsoft Defender Antivirus from Command Prompt on Windows 10



Windows 10 logo

Windows 10’s included Microsoft Defender antivirus, also known as Windows Defender, has a command line interface. Instead of using the graphical Windows Security app, you can run Windows 10’s built-in antivirus from Command Prompt, PowerShell, or Windows Terminal.

Run a quick virus scan

You can run a quick scan to look for viruses, malware, and other threats in a number of common places, such as the Windows registry and startup folders. This scan usually only takes a few minutes to complete.

To use this scan, open the “Start”

; menu, search for “Command Prompt”, right-click on the utility and select “Run as administrator”.

Run the command prompt as admin

Click “Yes” at the User Account Control prompt.

In the Command Prompt window, type the following to make the Microsoft Defender Antivirus directory your current working directory:

cd C:ProgramDataMicrosoftWindows DefenderPlatform4.18*

Go to the Microsoft Defender Antivirus folder

Note: If you make another folder your current working folder or close and reopen Command Prompt, run the above command before using other Microsoft Defender Antivirus commands.

Then enter the following command and press “Enter” to start a quick virus scan:

MpCmdRun -Scan -ScanType 1

Run a quick virus scan

You will see the progress of the live scan on your screen.

Run a full virus scan

A full scan thoroughly checks all your computer files for viruses, malware and other security risks. Since this is an extensive scan, it usually takes longer than the other scans.

You can run a full scan with the following command in the command prompt:

MpCmdRun -Scan -ScanType 2

Run a full virus scan

Note: If for some reason you need to stop a scan, press Ctrl + C on your keyboard.

Run a custom virus scan

You want to use a custom scan if you have certain files or folders that you want to scan for viruses, malware and other threats. You can also use this to scan files on your external storage such as your USB flash drives.

To use this, type the following command in the command prompt window and press “Enter”.

Make sure to replace “PATH” with the path to the folder or file you want to scan. If your path contains spaces, add double quotes before and after the path, like this: “C: Users Mahesh Desktop My Files”

MpCmdRun -Scan -ScanType 3 -File PATH

For example, if you want to scan your desktop for threats, run the following command and replace “MYNAME” with your username.

MpCmdRun -Scan -ScanType 3 -File C:UsersMYNAMEDesktop

Run a custom virus scan

Scan the boot sector files of your PC

The boot sector of your PC stores all essential information about starting your computer. This sector contains the code that starts your operating system.

Sometimes certain viruses and other threats attack this boot sector. When this happens, you will have trouble starting your computer. You can also face other problems.

RELATED: What to do if Windows does not start

If you think your PC is infected with a virus or malware, it is worth running a boot sector scan to find and remove suspicious content from this sector.

You can use the following Microsoft Defender Antivirus command to run a boot sector scan:

MpCmdRun -Scan -ScanType -BootSectorScan

Run a boot sector scan

Restore quarantined files

When Microsoft Defender Antivirus finds a suspicious file, it moves that file to the quarantine. This is a special location to store suspicious files and your files cannot be started when they are in the quarantine here.

If you think the antivirus has accidentally moved a file to quarantine, you can use a command to restore that file to its original location.

To do this, first run the following command to display a list of all your quarantined files:

MpCmdRun -Restore -ListAll

View quarantined files

Make a note of the name of the file you want to restore in the list. Then type the following command, replace “MyApp.exe” with the name of the file you want to restore and press “Enter”.

MpCmdRun -Restore -Name MyApp.exe

If you want to restore your file to a different folder, use the following command instead. Make sure to replace “PATH” with the path to your directory before running the command.

Of course, replace “MyApp.exe” with the name of the file you want to recover.

MpCmdRun -Restore -Name MyApp.exe -FilePath PATH

Update Microsoft Defender Antivirus

Microsoft Defender Antivirus regularly updates itself to make sure it can find newer viruses and threats. However, you can force it to search for and download newer updates at any time.

You can do this by running the following command in the command prompt window:

MpCmdRun -SignatureUpdate

Update the Microsoft Defender Antivirus

It updates the virus definitions without any prompt.

View all available Microsoft Defender Antivirus options

In addition to the above, there are many other command combinations you can use to get the most out of this antivirus on your Windows 10 PC.

To find all available commands and parameters, run this command in the command prompt:

MpCmdRun -h

View all Microsoft Defender Antivirus commands

You are now a professional when it comes to using Microsoft Defender Antivirus from the command prompt.

If you prefer the graphical interface, check out our guide on how to use Microsoft Defender Antivirus, which explains all the graphical features of this program.

RELATED: How to use the built-in Windows Defender Antivirus on Windows 10




Source link