@echo off
net session >nul 2>&1
if %errorlevel% neq 0 (
    echo Error: Please run this script as Administrator.
    pause
    exit /b
)

echo.
echo Terminating processes...
echo.

REM Попытка остановить spoolsv.exe через службу
echo Stopping Print Spooler service...
sc stop Spooler
if %errorlevel%==0 (
    echo Print Spooler stopped successfully.
) else (
    echo Error stopping Print Spooler.
)
echo.

REM Завершаем winws.exe
taskkill /f /im winws.exe
if %errorlevel%==0 (
    echo Process winws.exe terminated successfully.
) else (
    echo Error terminating winws.exe or process not found.
)
echo.

REM Завершаем SearchHost.exe
taskkill /f /im SearchHost.exe
if %errorlevel%==0 (
    echo Process SearchHost.exe terminated successfully.
) else (
    echo Error terminating SearchHost.exe or process not found.
)
echo.

REM Завершаем StartMenuExperienceHost.exe
taskkill /f /im StartMenuExperienceHost.exe
if %errorlevel%==0 (
    echo Process StartMenuExperienceHost.exe terminated successfully.
) else (
    echo Error terminating StartMenuExperienceHost.exe or process not found.
)
echo.

REM Завершаем goodbyedpi.exe
taskkill /f /im goodbyedpi.exe
if %errorlevel%==0 (
    echo Process StartMenuExperienceHost.exe terminated successfully.
) else (
    echo Error terminating StartMenuExperienceHost.exe or process not found.
)
echo.