@echo off
title DEFENDER CONTROL - MASTER EDITION
echo Xin thua I312100F_store
echo ============================================
echo   1 - TAT TOAN BO REAL-TIME PROTECTION
echo   2 - BAT LAI REAL-TIME PROTECTION
echo ============================================
set /p choice="Nhap lua chon (1 hoac 2): "

if "%choice%"=="1" goto DISABLE
if "%choice%"=="2" goto ENABLE
echo Sai lua chon.
pause
exit

:DISABLE
echo Dang tat toan bo Windows Defender...
net stop WinDefend /y 2>nul
net stop SecurityHealthService /y 2>nul
sc stop WinDefend 2>nul
sc stop WdNisSvc 2>nul

reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender" /v DisableAntiSpyware /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableRealtimeMonitoring /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableBehaviorMonitoring /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableOnAccessProtection /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableScanOnRealtimeEnable /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows Defender\Features" /v TamperProtection /t REG_DWORD /d 0 /f

schtasks /change /tn "Microsoft\Windows\Windows Defender\Windows Defender Cache Maintenance" /disable 2>nul
schtasks /change /tn "Microsoft\Windows\Windows Defender\Windows Defender Cleanup" /disable 2>nul
schtasks /change /tn "Microsoft\Windows\Windows Defender\Windows Defender Scheduled Scan" /disable 2>nul
schtasks /change /tn "Microsoft\Windows\Windows Defender\Windows Defender Verification" /disable 2>nul

echo Da tat hoan toan. Khoi dong lai may de ap dung.
pause
exit

:ENABLE
echo Dang bat lai Windows Defender...
reg add "HKLM\SOFTWARE\Microsoft\Windows Defender\Features" /v TamperProtection /t REG_DWORD /d 1 /f

reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender" /v DisableAntiSpyware /f 2>nul
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" /f 2>nul

schtasks /change /tn "Microsoft\Windows\Windows Defender\Windows Defender Cache Maintenance" /enable 2>nul
schtasks /change /tn "Microsoft\Windows\Windows Defender\Windows Defender Cleanup" /enable 2>nul
schtasks /change /tn "Microsoft\Windows\Windows Defender\Windows Defender Scheduled Scan" /enable 2>nul
schtasks /change /tn "Microsoft\Windows\Windows Defender\Windows Defender Verification" /enable 2>nul

sc config WinDefend start= auto 2>nul
net start WinDefend 2>nul

echo Da bat lai. Khoi dong lai may de ap dung.
pause
exit