Does anyone know how to start windows defender from a Batch file

Mackintire

2[H]4U
Joined
Jun 28, 2004
Messages
2,983
Here's the normal syntax: C:\Program Files\Windows Defender\MpCmdRun.exe Scan -ScanType 2


but it won t run from a batch file.

Anyone?
 
Code:
"C:\Program Files\Windows Defender\MpCmdRun.exe" Scan -ScanType 2

You need to wrap the full filename in quotes because it has spaces. I'm assuming your command line is correct -- I did not test it.

If you don't put quotes, windows things the "executable file" is C:\Program and that everything else is a parameter that you want to pass to it.
 
Tried that....
Tried that...
and Nope, still does not work....



Keep the ideas coming, because I am out.
 
Try appending START at the beginning of the command.
Example:

Code:
@ECHO OFF

SET MPPATH="C:\Program Files\Windows Defender\"

CD %MPPATH%
START MpCmdRun.exe Scan -ScanType 2

If that doesn't work, try running the batch file as Administrator.
 
That syntax is close..... and may actually work.

I 'm going to do some debuging and get back to you in a week.

Merry Christmas

Mackintire
 
Gushpinbob's syntax results in Windows defender updating. But earlier in the day anytime I had that response the actual Windows defender scan started immediately afterwards. Right now, on my machine that is not happening. So there might be something going on specifically with my machine. Gushpinbob's syntax might be 100% correct, but I will not be able to restart my computer for a while to determine the facts one.way or another.
 
Open a command prompt and enter your commands from there. that way you can see any errors.
 
Open a command prompt and enter your commands from there. that way you can see any errors.

That's the issue ... it works fine, almost every which way, when you enter the commands into a command prompt.

I did attempt to add a pause between steps.

In some cases The response is not a error. The response is no response.

In some cases, the response is "the path can not be found". Which is strange because it works fine when you type the same thing into the command prompt window.
 
Last edited:
Back
Top