How To Run Windows Defender as Command-line to Automate Tasks in Windows 10


Windows Defender is the default anti-malware built right in the Windows. Usually, it runs quietly as a service with a GUI that you can use to run some tasks manually. Do you also know that you can run Windows Defender as a command-line so you can automate tasks with Task Scheduler?



MSASCui.exe is the Windows Defender GUI executable that also comes with the switches you can run as the command-line.

Run the updates followed by a quick scan

"%ProgramFiles%\Windows Defender\MSASCui.exe" -UpdateAndQuickScan

Run a quick scan

"%ProgramFiles%\Windows Defender\MSASCui.exe" -QuickScan

Run a full scan

"%ProgramFiles%\Windows Defender\MSASCui.exe" -FullScan

Run the updates

"%ProgramFiles%\Windows Defender\MSASCui.exe" -Update

Run the tasks in hidden mode

To run any of the above tasks without the GUI window showing up, add the “-hide” at the end.


MpCmdRun.exe is the Windows Defender Console that also comes with quite a few switches that you can use.

Run the updates followed by a quick scan

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

Run a quick scan

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

Run a full scan

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

Run a scan on file or directory

"%ProgramFiles%\Windows Defender\MpCmdRun.exe" -Scan -ScanType 3 -File <Path>

Run a scan on the boot sector

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

Run the updates

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

To see the complete list

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


With these switches available in hand, you can easily create a task in Task Scheduler with the proper switch to automate the tasks like running updates, performing a full scan or custom scan on a certain type of files or folders, etc.



Please enter your comment!
Please enter your name here