cc-connect ??? Windows ??????

???

cc-connect ?????????????????Claude Code ?????????????lack ??????????
???????????????????????????????????????????????????????????????????????????????? Windows ?????
????????

  • Windows 10 Pro
  • Node.js 24.16.0????? nvm ?$??????E:\software\nvm??- cc-connect v1.3.2??pm ????????- ????????C:\Users\[?????\.cc-connect\config.toml

??????????

???????????????????g?????????????????

# ============================================================
# ?????????????????????
# ============================================================
$CC_BIN   = "E:\software\nvm\v24.16.0\node_modules\cc-connect\bin\cc-connect.exe"
$CONFIG   = "$env:USERPROFILE\.cc-connect\config.toml"
$NSSM     = "C:\Program Files\nssm\nssm.exe"
$LOG_DIR  = "$env:USERPROFILE\.cc-connect"
$SVC_NAME = "cc-connect"
$SVC_DISP = "cc-connect AI Bridge"

??????

Windows ???????????????????????

??? ??? ??? ???
sc.exe sc create ????????????????? ??stop ?????????????????????
New-Service PowerShell cmdlet PowerShell ??????????? ?????sc.exe????????????
nssm nssm install ???????$??????tart/stop ??? ?????????????????500KB??

????????nssm

Windows ????$????SCM??? stop ????????????????????????????SERVICE_CONTROL_STOP??ssm??on-Sucking Service Manager????????????????????????????????????start/stop ????????? CreateProcess + GenerateConsoleCtrlEvent ?$??????????????????????????

nssm ?????????

1. ??? nssm

# ??winget ?????????$???????
winget install nssm

# ?????????????Get-Command nssm -ErrorAction SilentlyContinue
# ???????????Test-Path "C:\Program Files\nssm\nssm.exe"

????????C:\Program Files\nssm\nssm.exe??
??? winget ????????https://nssm.cc/download ????????

2. ??????

# ============================================================
# ???????????????????????# ============================================================
$CC_BIN   = "E:\software\nvm\v24.16.0\node_modules\cc-connect\bin\cc-connect.exe"
$CONFIG   = "$env:USERPROFILE\.cc-connect\config.toml"
$NSSM     = "C:\Program Files\nssm\nssm.exe"
$SVC_NAME = "cc-connect"

# ---------------------
# ??? A??????????????????????????# ---------------------
& $NSSM install $SVC_NAME

# ???????????~???
#   Application:  $CC_BIN ????????#   Arguments:    --config $CONFIG --force
#   Startup directory: $env:USERPROFILE\.cc-connect

# ---------------------
# ??? B?????????????# ---------------------
& $NSSM install $SVC_NAME $CC_BIN "--config $CONFIG --force"

# ---------------------
# ?????????
# ---------------------
& $NSSM set $SVC_NAME AppDirectory "$env:USERPROFILE\.cc-connect"

# ---------------------
# ????????????
# ---------------------
& $NSSM set $SVC_NAME AppStdout "$env:USERPROFILE\.cc-connect\service-output.log"
& $NSSM set $SVC_NAME AppStderr "$env:USERPROFILE\.cc-connect\service-error.log"

# ---------------------
# ??????
# ---------------------
& $NSSM start $SVC_NAME

# ???????& $NSSM status $SVC_NAME
# ??Get-Service $SVC_NAME

3. ?$????

# ============================================================
# ????$????????????# ============================================================
$NSSM     = "C:\Program Files\nssm\nssm.exe"
$SVC_NAME = "cc-connect"

# ---- nssm ??? ----
& $NSSM start   $SVC_NAME
& $NSSM stop    $SVC_NAME
& $NSSM restart $SVC_NAME
& $NSSM status  $SVC_NAME

# ---- PowerShell ??????????????? ----
Start-Service   -Name $SVC_NAME
Stop-Service    -Name $SVC_NAME
Restart-Service -Name $SVC_NAME
Get-Service     -Name $SVC_NAME

# ---- sc.exe????????? ----
sc.exe start   $SVC_NAME
sc.exe stop    $SVC_NAME
sc.exe restart $SVC_NAME
sc.exe query   $SVC_NAME

# ---- ?????? ----
services.msc
# ????????? "cc-connect AI Bridge"????????```

### 4. ??????

```powershell
# ============================================================
# ?????????
# ============================================================
$LOG_DIR = "$env:USERPROFILE\.cc-connect"

# ????????????
Get-Content "$LOG_DIR\service-output.log" -Tail 50 -Wait

# ?????????
Get-Content "$LOG_DIR\service-error.log" -Tail 50

# ????????????Get-Content "$LOG_DIR\service-output.log"

nssm ??????????$????????????????

  • C:\Users\JA016620\.cc-connect\service-output.log
  • C:\Users\JA016620\.cc-connect\service-error.log

5. ?????????

# ============================================================
# ??????
# ============================================================
$NSSM     = "C:\Program Files\nssm\nssm.exe"
$SVC_NAME = "cc-connect"

# ????????????????????? 10 ???
& $NSSM set $SVC_NAME AppRestartDelay 10000

# ?????????????10MB?????????
& $NSSM set $SVC_NAME AppRotateBytes 10485760

# ????????????????????????????????????????????
& $NSSM dump $SVC_NAME

6. ??????

# ============================================================
# ??????????????# ============================================================
$NSSM     = "C:\Program Files\nssm\nssm.exe"
$SVC_NAME = "cc-connect"

# ?????& $NSSM stop $SVC_NAME

# ??????????'???
& $NSSM remove $SVC_NAME confirm

sc.exe ???????????

????????????????????indows ?????sc.exe ???????????
**?????????????????*?????????????

# ============================================================
# ??????????????# ============================================================
$CC_BIN   = "E:\software\nvm\v24.16.0\node_modules\cc-connect\bin\cc-connect.exe"
$CONFIG   = "$env:USERPROFILE\.cc-connect\config.toml"
$SVC_NAME = "cc-connect"
$SVC_DISP = "cc-connect AI Bridge"

sc.exe create $SVC_NAME `
  binPath= "`"$CC_BIN`" --config `"$CONFIG`" --force" `
  start= auto `
  DisplayName= $SVC_DISP

# ??????
sc.exe query $SVC_NAME
Get-Service $SVC_NAME

# ---- ?$? ----
sc.exe start   $SVC_NAME
sc.exe stop    $SVC_NAME
sc.exe restart $SVC_NAME
sc.exe query   $SVC_NAME

# ---- ?????? ----
sc.exe config $SVC_NAME start= auto     # ?????????
sc.exe config $SVC_NAME start= demand   # ?????????

# ---- ??? ----
sc.exe stop   $SVC_NAME
sc.exe delete $SVC_NAME

????$????

????????? manage-cc-connect.ps1??????????????????????

<#
.SYNOPSIS
  cc-connect ????$????
.DESCRIPTION
  ????????????????????
.PARAMETER Action
  start|stop|restart|status|logs|uninstall
.EXAMPLE
  .\manage-cc-connect.ps1 status
  .\manage-cc-connect.ps1 logs
#>

param(
  [ValidateSet("start","stop","restart","status","logs","uninstall")]
  [string]$Action = "status"
)

$SVC_NAME = "cc-connect"
$LOG_DIR  = "$env:USERPROFILE\.cc-connect"

switch ($Action) {
  "start" {
    Write-Host "????? cc-connect ???..." -ForegroundColor Cyan
    Start-Service -Name $SVC_NAME -ErrorAction Stop
    Write-Host "??????? -ForegroundColor Green
  }
  "stop" {
    Write-Host "????? cc-connect ???..." -ForegroundColor Yellow
    Stop-Service -Name $SVC_NAME -ErrorAction Stop
    Write-Host "??????? -ForegroundColor Green
  }
  "restart" {
    Write-Host "?? ??? cc-connect ???..." -ForegroundColor Cyan
    Restart-Service -Name $SVC_NAME -ErrorAction Stop
    Write-Host "??????? -ForegroundColor Green
  }
  "status" {
    $svc = Get-Service -Name $SVC_NAME -ErrorAction SilentlyContinue
    if (-not $svc) {
      Write-Host "????? $SVC_NAME ????? -ForegroundColor Red
      return
    }
    Write-Host "?? $SVC_NAME ???? $($svc.Status)" -ForegroundColor Cyan
    Write-Host "   ??????: $($svc.StartType)"
  }
  "logs" {
    $logFile = "$LOG_DIR\service-output.log"
    if (-not (Test-Path $logFile)) {
      Write-Host "????????????? $logFile" -ForegroundColor Red
      return
    }
    Write-Host "?? ?????? (Ctrl+C ????..." -ForegroundColor Cyan
    Get-Content $logFile -Tail 30 -Wait
  }
  "uninstall" {
    Write-Host "???e???? cc-connect ???..." -ForegroundColor Yellow
    Stop-Service -Name $SVC_NAME -ErrorAction SilentlyContinue
    Start-Sleep 2
    sc.exe delete $SVC_NAME
    Write-Host "??????? -ForegroundColor Green
  }
}

????????

# ???????.\manage-cc-connect.ps1 status

# ???
.\manage-cc-connect.ps1 start
.\manage-cc-connect.ps1 stop
.\manage-cc-connect.ps1 restart

# ????????trl+C ?????
.\manage-cc-connect.ps1 logs

??????

1. cc-connect ?????daemon ????????Windows

# ????? Windows ???????cc-connect daemon install

# ???????nssm ??sc.exe ??????????????```

???????????Linux??ystemd??? macOS??aunchd?????Windows ????????
### 2. nssm ?????????

```powershell
# ??? nssm ????????? NUL ????????& "C:\Program Files\nssm\nssm.exe" get "cc-connect" Application
# ???????? E : \ s o f t w a r e \ ...

??? nssm ????????????????????????????????????????

3. ???????????

cc-connect ???????????????

  1. ????????? config.toml
  2. ~/.cc-connect/config.toml

??????????????? C:\Windows\System32?????????????*???**??--config ?????????????????cc-connect ??????????
????????? --force??'??????????????????????

???

cc-connect ?????Windows ???????????????

  1. ??? nssm????????sc.exe??2. ??????????????????????????????????????
  2. ???????????tart= auto??
    ???????????c-connect ?????????????????????/???????????Claude Code ????????????????????????????
    ???????????Docker ??? cc-connect?????? Docker Desktop ???????+ ??? restart: unless-stopped ????????????????indows ??????????????????????????Docker ??????????
posted @ 2026-05-26 18:16  司野良  阅读(15)  评论(0)    收藏  举报