@echo off
REM ============================================================
REM  Oil Trading Agent - Web-Backend stoppen
REM  Beendet den python-Prozess, der server.py ausfuehrt.
REM  Nutzt absolute Pfade (PATH-unabhaengig).
REM ============================================================
title Oil Trading Server - Stop
set "PS=%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe"
"%PS%" -NoProfile -Command "$p = Get-CimInstance Win32_Process | Where-Object { $_.Name -eq 'python.exe' -and $_.CommandLine -like '*server.py*' }; if ($p) { $p | ForEach-Object { Stop-Process -Id $_.ProcessId -Force; Write-Host ('Gestoppt: PID ' + $_.ProcessId) } } else { Write-Host 'Kein laufender Server gefunden.' }"
echo.
pause
