@echo off setlocal title Talk set "TALK_SERVER=@@SERVER@@" set "TALK_HOME=%LOCALAPPDATA%\wxch\Talk" if not defined LOCALAPPDATA goto failed if not exist "%TALK_HOME%" mkdir "%TALK_HOME%" echo Updating Talk receiver... :download curl.exe --fail --silent --show-error --connect-timeout 15 --max-time 60 "%TALK_SERVER%/worker.py" -o "%TALK_HOME%\worker.py.download" if errorlevel 1 goto downloadRetry move /Y "%TALK_HOME%\worker.py.download" "%TALK_HOME%\worker.py" >nul if errorlevel 1 goto failed set "TALK_PY=" py -3 --version >nul 2>&1 if not errorlevel 1 set "TALK_PY=py -3" if defined TALK_PY goto ready python --version >nul 2>&1 if not errorlevel 1 set "TALK_PY=python" if defined TALK_PY goto ready for %%V in (315 314 313 312 311) do if exist "%LOCALAPPDATA%\Programs\Python\Python%%V\python.exe" set TALK_PY="%LOCALAPPDATA%\Programs\Python\Python%%V\python.exe" if defined TALK_PY goto ready echo Python is needed once. Installing Python for this Windows user... winget install --exact --id Python.Python.3.13 --scope user if errorlevel 1 goto failed py -3 --version >nul 2>&1 if not errorlevel 1 set "TALK_PY=py -3" if defined TALK_PY goto ready if exist "%LOCALAPPDATA%\Programs\Python\Python313\python.exe" set TALK_PY="%LOCALAPPDATA%\Programs\Python\Python313\python.exe" if not defined TALK_PY goto restart :ready if /I "%~1"=="add" goto add %TALK_PY% "%TALK_HOME%\worker.py" start --server "%TALK_SERVER%" @@ADD@@ goto finished :add %TALK_PY% "%TALK_HOME%\worker.py" start --server "%TALK_SERVER%" --add goto finished :downloadRetry echo Talk download unavailable. Retrying in 10 seconds; Ctrl+C stops. timeout /t 10 /nobreak >nul goto download :restart echo Python is installed. Close this window and double-click Start-Talk.cmd again. goto finished :failed echo Talk could not start. Check this computer's approved network access and the error above. :finished pause