| @echo off |
| if not exist "%~dp0wget.exe" (echo 本脚本需要命令提示符下载工具wget.exe支持&echo 下载地址:http://users.ugent.be/~bpuype/wget/wget.exe&pause>nul) |
| call :reg_ |
| if exist %windir%\SysWOW64\*.* (set x=x64&set xM=64) else (set x=x86&set xM=32) |
| set mseM0=正在下载 Microsoft Security Essentials(微软安全套装 %xM% 位)简体中文版... |
| set mseM1=正在下载 Microsoft Security Essentials(微软安全套装 %xM% 位)最新病毒定义库... |
| set mseM2=正在下载 Microsoft Security Essentials(微软安全套装 %xM% 位)最新病毒定义增量库... |
| set nisM1=正在下载 Microsoft Security Essentials(微软安全套装 %xM% 位)最新网络安全定义库... |
| set setupM=正在安装 Microsoft Security Essentials(微软安全套装 %xM% 位) |
| |
| md %x%>nul 2>nul |
| call :%x% |
| cls&echo.&echo %setupM% |
| "%~dp0%x%\mseinstall.exe" /s /runwgacheck /o |
| if %x%#==x64 |
| "%~dp0%x%\nis_full.exe" /q |
| "%~dp0%x%\mpam-d.exe" /q |
| start "" "%ProgramFiles%\Microsoft Security Client\msseces.exe" |
| ping -n 5 127.0.0.1 >nul 2>nul |
| start "" "%ProgramFiles%\Microsoft Security Client\msseces.exe" -hide -runkey |
| goto:eof |
| ::::::执行立即更新病毒库参数可以用下面的命令 |
| ::::::start "" "%ProgramFiles%\Microsoft Security Client\msseces.exe" /update |
| ::::::执行更新病毒库后执行快速扫描可以用下面的命令 |
| ::::::start "" "%ProgramFiles%\Microsoft Security Client\msseces.exe" /updateandquickscan |
| ::::::将Microsoft Security Essentials添加到防火墙允许列表可以用下面的命令 |
| ::::::netsh firewall add allowedprogram program="%ProgramFiles%\Microsoft Security Client\msseces.exe" name= "Microsoft Security Essentials" mode=enable |
| |
| :x86 |
| setlocal enabledelayedexpansion |
| if not exist %x%\mseinstall.exe cls&echo.&echo %mseM0%&wget.exe -N -P %x% http://download.microsoft.com/download/1/E/D/1ED80C09-218B-44D7-B72D-E1451634E72D/zh-cn/mseinstall.exe |
| if not exist %x%\mpam-fe.exe ( |
| cls&echo.&echo %mseM1%&wget.exe -N -P %x% http://download.microsoft.com/download/DefinitionUpdates/mpam-fe.exe |
| ) else ( |
| call :choice_ |
| if /i !choice! |
| ) |
| cls&echo.&echo %mseM2%&wget.exe -N -P %x% http://download.microsoft.com/download/DefinitionUpdates/x86/mpam-d.exe |
| cls&echo.&echo %nisM1%&wget.exe -N -P %x% http://download.microsoft.com/download/DefinitionUpdates/x86/nis_full.exe |
| endlocal&goto:eof |
| |
| :x64 |
| setlocal enabledelayedexpansion |
| if not exist %x%\mseinstall.exe cls&echo.&echo %mseM0%&wget.exe -N -P %x% http://download.microsoft.com/download/1/E/D/1ED80C09-218B-44D7-B72D-E1451634E72D/zh-cn/amd64/mseinstall.exe |
| if not exist %x%\mpam-fex64.exe ( |
| cls&echo.&echo %mseM1%&wget.exe -N -P %x% http://download.microsoft.com/download/DefinitionUpdates/mpam-fex64.exe |
| ) else ( |
| call :choice_ |
| if /i !choice! |
| ) |
| cls&echo.&echo %mseM2%&wget.exe -N -P %x% http://download.microsoft.com/download/DefinitionUpdates/amd64/nis_full.exe |
| cls&echo.&echo %nisM1%&wget.exe -N -P %x% http://download.microsoft.com/download/DefinitionUpdates/amd64/mpam-d.exe |
| endlocal&goto:eof |
| |
| :choice_ |
| cls&echo. |
| set /p choice=是否更新本地病毒定义离线包?(下载持续5~10分钟)按Y/N: |
| if defined choice (set choice=!choice:~0,1!) |
| goto:eof |
| |
| :reg_ |
| rem Microsoft Security Essentials 优化设置 |
| :排除的文件类型 |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Exclusions\Extensions" /v "cab" /t REG_DWORD /d 0 /f >nul 2>nul |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Exclusions\Extensions" /v "rar" /t REG_DWORD /d 0 /f >nul 2>nul |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Exclusions\Extensions" /v "zip" /t REG_DWORD /d 0 /f >nul 2>nul |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Exclusions\Extensions" /v "z" /t REG_DWORD /d 0 /f >nul 2>nul |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Exclusions\Extensions" /v "7z" /t REG_DWORD /d 0 /f >nul 2>nul |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Exclusions\Extensions" /v "iso" /t REG_DWORD /d 0 /f >nul 2>nul |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Exclusions\Extensions" /v "img" /t REG_DWORD /d 0 /f >nul 2>nul |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Exclusions\Extensions" /v "wim" /t REG_DWORD /d 0 /f >nul 2>nul |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Exclusions\Extensions" /v "vhd" /t REG_DWORD /d 0 /f >nul 2>nul |
| :排除文件和位置 |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Exclusions\Paths" /v "E:\\Backup" /t REG_DWORD /d 0 /f >nul 2>nul |
| :排除进程名 |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Exclusions\Processes" /v "wget.exe" /t REG_DWORD /d 0 /f >nul 2>nul |
| :隔离项目在一个月后自动删除 |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Quarantine" /v "PurgeItemsAfterDelay" /t REG_DWORD /d 30 /f >nul 2>nul |
| :控制 CPU 使用率限制30% |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Scan" /v "AvgCPULoadFactor" /t REG_DWORD /d 30 /f >nul 2>nul |
| :不扫描存档文件 |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Scan" /v "DisableArchiveScanning" /t REG_DWORD /d 1 /f >nul 2>nul |
| :严重级别(删除操作) |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Threats\ThreatSeverityDefaultAction" /v "5" /t REG_DWORD /d 3 /f >nul 2>nul |
| :高级别(隔离操作) |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Threats\ThreatSeverityDefaultAction" /v "4" /t REG_DWORD /d 2 /f >nul 2>nul |
| :中级别(隔离操作) |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Threats\ThreatSeverityDefaultAction" /v "3" /t REG_DWORD /d 2 /f >nul 2>nul |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Threats\ThreatSeverityDefaultAction" /v "2" /t REG_DWORD /d 2 /f >nul 2>nul |
| :低级别(允许操作) |
| reg add "HKLM\SOFTWARE\Microsoft\Microsoft Antimalware\Threats\ThreatSeverityDefaultAction" /v "1" /t REG_DWORD /d 6 /f >nul 2>nul |
| goto:eofCOPY |