@echo off
setlocal EnableExtensions
set "IPLAN=172.29.127.122"
set "IPWIFI=192.168.2.199"

reg add "HKCU\Software\K-Diagnostics\SDconnect" /v IPLAN /t REG_SZ /d "%IPLAN%" /f >nul
reg add "HKCU\Software\K-Diagnostics\SDconnect" /v IPWIFI /t REG_SZ /d "%IPWIFI%" /f >nul
reg add "HKCU\Software\K-Diagnostics\SDconnect" /v PreferredIP /t REG_SZ /d "%IPLAN%" /f >nul
reg add "HKCU\Software\K-Diagnostics\SDconnect" /v TargetIP1 /t REG_SZ /d "%IPLAN%,SDconnect" /f >nul
reg add "HKCU\Software\K-Diagnostics\SDconnect" /v TargetIP2 /t REG_SZ /d "%IPWIFI%,SDconnect" /f >nul

set "CFG=%ProgramData%\K-Diagnostics\SDconnect"
if not exist "%CFG%" mkdir "%CFG%" >nul 2>&1
(
  echo [SDconnect]
  echo IPLAN=%IPLAN%
  echo IPWIFI=%IPWIFI%
  echo PreferredOrder=LAN,WIFI
  echo.
  echo [SETTING]
  echo TargetIP1=%IPLAN%,SDconnect
  echo TargetIP2=%IPWIFI%,SDconnect
) > "%CFG%\KDX_SDconnect_Network.ini"

echo SDconnect configured:
echo   LAN:   %IPLAN%  ^(priority 1^)
echo   Wi-Fi: %IPWIFI% ^(priority 2^)
echo   File:  %CFG%\KDX_SDconnect_Network.ini
exit /b 0
