@echo off rem dsh-memory - idempotent bridge starter setlocal set "ROOT=%~dp0.." if not exist "%ROOT%\bridge\config.json" ( echo [dsh-memory] bridge\config.json not found. Run scripts\pair.ps1 first. pause exit /b 1 ) powershell -NoProfile -Command "if (Get-NetTCPConnection -LocalPort 8766 -State Listen -ErrorAction SilentlyContinue) { exit 0 } else { exit 1 }" if %errorlevel%==0 ( echo [dsh-memory] bridge already running on port 8766. ) else ( echo [dsh-memory] starting bridge... start "dsh-memory bridge" /D "%ROOT%" cmd /c "title dsh-memory bridge && node bridge\server.js & pause" ping -n 3 127.0.0.1 >nul powershell -NoProfile -Command "if (Get-NetTCPConnection -LocalPort 8766 -State Listen -ErrorAction SilentlyContinue) { Write-Host '[dsh-memory] bridge started.' } else { Write-Host '[dsh-memory] bridge NOT started. Is node in PATH? Check the bridge window.' }" ) endlocal