1.

Solve : Call Windows defender from a batch file?

Answer»

I am trying to call up a Windows Defender scan from a batch file in a sequence W/ other apps. The WD line looks like this:
start /w "C:\Program Files\Windows Defender\MpCmdRun.exe" Scan -ScanType config -Privileges restricted

It gives the following error: "Could not find "scan"...
I need it to run in a sequence and wait untill the WD scan is done to move on to the next item.
What am I doing wrong? Any help would be greatly appreciated. Thanks.

Maybe Scan is also a switch, and needs a "-" (minus) sign before it.Code: [Select]start /wait "C:\Program Files\Windows Defender\MpCmdRun.exe Scan -ScanType config -Privileges restricted"

Replace config with either 1 for a quick scan or 2 for a FULL scan. Also, quote the entire COMMAND including the parameters.

Hope this helps. 8-)I tried it like this:
start /w "C:\Program Files\Windows Defender\MpCmdRun.exe Scan -ScanType config -Privileges restricted"

It does not start the scan, just opens another DOS window.

I tried it like this:
start /wait "C:\Program Files\Windows Defender\MpCmdRun.exe" -Scan -ScanType config -Privileges restricted

It says Windows cannot find "scan"...

Is the program name too LONG? Do I have to abbreviate it- like C:\prog~1 ?

Thanks again for the help.There appears to be some confusion here. The word config is not a keyword but a placeholder to which you are expected to supply a value.

Consider:

For a quick scan:

start /wait "C:\Program Files\Windows Defender\MpCmdRun.exe Scan -ScanType 1 -Privileges restricted"


For a full scan:

start /wait "C:\Program Files\Windows Defender\MpCmdRun.exe Scan -ScanType 2 -Privileges restricted"

I would suggest you run this inline with your batch file and get rid of start /wait.

Good luck. 8-)



Discussion

No Comment Found