@echo off rem Graceful stop: drop the stop flag so the worker loop exits, rem then kill any leftover listener / database processes. type nul > C:\Users\12914\Desktop\dsh\stop.flag powershell -Command "Get-NetTCPConnection -LocalPort 8020 -State Listen -ErrorAction SilentlyContinue | Select-Object -ExpandProperty OwningProcess -Unique | ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }" C:\Users\12914\Desktop\dsh\.pg\bin\pg_ctl.exe -D C:\Users\12914\Desktop\dsh\.pg\data stop -m fast >nul 2>&1 echo dsh-sync stopped.