@echo off
chcp 65001 >nul
echo ========================================================
echo   Windows Defender Klasor Dislamasi Ekleyicisi
echo ========================================================
echo.

:: Yonetici yetkisi kontrolü (Add-MpPreference admin yetkisi ister)
net session >nul 2>&1
if %errorLevel% neq 0 (
    echo [!] HATA: Bu scripti calistirmak icin yonetici yetkisi gerekiyor!
    echo Lutfen dosyaya sag tiklayip "Yonetici olarak calistir" secenegini secin.
    echo.
    pause
    exit /B
)

:: Scriptin calistigi klasor yolunu al
set "TARGET_DIR=%~dp0"
:: Sondaki ters slash (\) işaretini temizle (PowerShell path hatasi vermemesi icin)
if "%TARGET_DIR:~-1%"=="\" set "TARGET_DIR=%TARGET_DIR:~0,-1%"

echo Hedef Klasor: %TARGET_DIR%
echo Windows Defender dislama listesine ekleniyor, lutfen bekleyin...

powershell -Command "Add-MpPreference -ExclusionPath '%TARGET_DIR%'"

echo.
echo [BAŞARILI] Bu klasor ve icindeki tum EXE/dosyalar Windows Defender'dan muaf tutuldu!
echo Artik Defender bu klasore dokunmayacak.
echo.
pause