Fail 发表于 2021-3-21 10:22:06

通过bat脚本关闭/开启Windows Defender实时保护



通过bat脚本实现关闭或者开启Windows Defende的实时保护:

@Echo off
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
powershell "if((Get-MpPreference).DisableRealtimeMonitoring){Set-MpPreference -DisableRealtimeMonitoring 0;echo WindowsDefender实时保护已开启}else{Set-MpPreference -DisableRealtimeMonitoring 1;echo WindowsDefender实时保护已关闭}"
pause
成品下载:https://fzw.lanzoux.com/ig1Gtn5l6gb

备用链接:https://www.90pan.com/b2419738

页: [1]
查看完整版本: 通过bat脚本关闭/开启Windows Defender实时保护