@echo off
setlocal

:: --- Admin Elevation Check ---
echo Checking for Admin privileges...
echo.
net session >nul 2>&1
if %errorlevel% neq 0 (
  echo Requesting administrative privileges...
 echo.
  powershell -NoProfile -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
  exit /b
)

echo.
echo Removing 'Exclude from Windows Defender' context menu entries...
echo.

:: --- Inline PowerShell to delete registry keys (including subkeys) ---
powershell -NoProfile -ExecutionPolicy Bypass -Command "Remove-Item -LiteralPath 'Registry::HKEY_CLASSES_ROOT\*\shell\Exclude from Windows Defender' -Recurse -Force -ErrorAction SilentlyContinue; Remove-Item -LiteralPath 'Registry::HKEY_CLASSES_ROOT\Folder\shell\Exclude from Windows Defender' -Recurse -Force -ErrorAction SilentlyContinue; Write-Host 'Successfully removed Defender context menu.'"

echo.
pause
endlocal
