-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathavscan.cmd
38 lines (38 loc) · 1.51 KB
/
avscan.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@echo off & @rem based on XNT.kex script template version 2016-03-05
setlocal enableextensions & prompt @
set PROG=Microsoft Security Client\MpCmdRun.exe
set OPTS=-Scan -ScanType 3 -DisableRemediation -File
if not "%~2" == "" call "%~0" "%*"
if not "%~2" == "" goto DONE & @rem expect one argument
if "%~1" == "" goto HELP & @rem expect one argument
if "%~1" == "?" goto HELP & @rem missing switch char
if "%~1" == "/?" goto HELP & @rem minimal requirement
if "%~1" == "-?" goto HELP & @rem permit DOS SWITCHAR
:DOIT --------------------------------------------------------------
set SCAN=%ProgramW6432%\%PROG%
set NEED=%SCAN%
if not exist "%NEED%" goto NEED
set NEED=%~1
if not exist "%NEED%" goto NEED
"%SCAN%" %OPTS% "%~f1"
echo exit code [%ERRORLEVEL%]
goto WAIT
:NEED --------------------------------------------------------------
echo/
echo Error: %0 found no "%NEED%"
:HELP --------------------------------------------------------------
echo Usage: %0 FILE
echo/
echo runs "%PROG%" with
echo options %OPTS%
echo for the given FILE (or directory, incl. archives.)
echo/
echo If an application allows to configure an anti virus
echo scanner try %~f0
echo/
md . 2>nul & @rem non-zero errorlevel for security script
:WAIT if first CMD line option was /c ------------------------------
set NEED=usebackq tokens=2 delims=/
for /F "%NEED% " %%c in ('%CMDCMDLINE%') do if /I "%%c" == "c" pause
:DONE -------------- (Frank Ellermann, 2016) -----------------------