@echo off
chcp 65001 >nul
title 家里 VPN 一键配置
net session >nul 2>&1
if errorlevel 1 (
  powershell -NoProfile -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
  exit /b
)
echo [1/3] 导入家里 VPN 证书...
certutil -addstore -f Root "%~dp0ca.cer" >nul
echo [2/3] 创建 VPN 连接（只走家里网段，不拖慢上网）...
powershell -NoProfile -Command "Add-VpnConnection -Name '家里VPN' -ServerAddress '192.168.1.10' -TunnelType Sstp -AuthenticationMethod Pap -SplitTunneling -Force; Add-VpnConnection -Name '家里VPN-外网' -ServerAddress '1.207.145.186' -TunnelType Sstp -AuthenticationMethod Pap -SplitTunneling -Force"
echo [3/3] 完成
echo.
echo 打开：设置 - 网络和 Internet - VPN，点“家里VPN”连接
echo 账号 vpnuser  密码 vpn168168
echo 在家用“家里VPN”，在外面用“家里VPN-外网”（需光猫已做端口映射）
pause