Windows
Windows
Section titled “Windows”OpenClaw 支援 原生 Windows 和 WSL2。WSL2 是更穩定的路徑,建議用於完整體驗 — CLI、Gateway 和工具在 Linux 內部執行,具有完全相容性。原生 Windows 適用於核心 CLI 和 Gateway 使用,但有一些注意事項如下所述。
原生 Windows 伴隨應用程式已在規劃中。
WSL2 (建議)
Section titled “WSL2 (建議)”- 快速入門 (在 WSL 內使用)
- 安裝與更新
- 官方 WSL2 指南 (Microsoft):https://learn.microsoft.com/windows/wsl/install
原生 Windows 狀態
Section titled “原生 Windows 狀態”原生 Windows CLI 流程正在改善,但 WSL2 仍然是建議的路徑。
目前原生 Windows 上運作良好的功能:
- 透過
install.ps1進行網站安裝 - 本機 CLI 使用,例如
openclaw --version、openclaw doctor和openclaw plugins list --json - 嵌入式本機代理程式/提供者測試例如:
openclaw agent --local --agent main --thinking low -m "Reply with exactly WINDOWS-HATCH-OK."當前注意事項:
openclaw onboard --non-interactive仍然預期可連線的本地 gateway,除非您傳遞--skip-healthopenclaw onboard --non-interactive --install-daemon和openclaw gateway install會先嘗試 Windows 工作排程器- 如果工作排程器建立被拒絕,OpenClaw 會退回到個別使用者的啟動資料夾登入項目,並立即啟動 gateway
- 如果
schtasks本身卡住或停止回應,OpenClaw 現在會快速中止該路徑並退回,而不是永遠卡住 - 當可用時,工作排程器仍然是首選,因為它們提供更好的監督者狀態
如果您只想要原生 CLI,而不安裝 gateway 服務,請使用以下其中之一:
openclaw onboard --non-interactive --skip-healthopenclaw gateway run如果您確實想要原生 Windows 上的管理啟動:
openclaw gateway installopenclaw gateway status --json如果工作排程器建立被封鎖,退回服務模式仍會透過目前使用者的啟動資料夾在登入後自動啟動。
Gateway
Section titled “Gateway”Gateway 服務安裝 (CLI)
Section titled “Gateway 服務安裝 (CLI)”在 WSL2 內:
openclaw onboard --install-daemon或者:
openclaw gateway install或者:
openclaw configure出現提示時,選擇 Gateway service。
修復/遷移:
openclaw doctorWindows 登入前自動啟動 Gateway
Section titled “Windows 登入前自動啟動 Gateway”對於無介面設置,請確保即使沒有人登入 Windows,完整的啟動鏈也能運行。
1) 保持使用者服務在未登入時運行
Section titled “1) 保持使用者服務在未登入時運行”在 WSL 內部:
sudo loginctl enable-linger "$(whoami)"2) 安裝 OpenClaw gateway 使用者服務
Section titled “2) 安裝 OpenClaw gateway 使用者服務”在 WSL 內部:
openclaw gateway install3) 在 Windows 開機時自動啟動 WSL
Section titled “3) 在 Windows 開機時自動啟動 WSL”以系統管理員身分在 PowerShell 中:
schtasks /create /tn "WSL Boot" /tr "wsl.exe -d Ubuntu --exec /bin/true" /sc onstart /ru SYSTEM將 Ubuntu 替換為您從以下位置取得的發行版本名稱:
wsl --list --verbose重新開機後(在 Windows 登入前),從 WSL 檢查:
systemctl --user is-enabled openclaw-gatewaysystemctl --user status openclaw-gateway --no-pager進階:透過 LAN 暴露 WSL 服務 (portproxy)
Section titled “進階:透過 LAN 暴露 WSL 服務 (portproxy)”WSL 擁有自己的虛擬網路。如果另一台機器需要連線到在 WSL 內部 執行的服務 (SSH、本地 TTS 伺服器或 Gateway),您必須將 Windows 埠轉發到目前的 WSL IP。WSL IP 會在重啟後變更, 因此您可能需要重新整理轉發規則。
範例(以 系統管理員 身分執行 PowerShell):
$Distro = "Ubuntu-24.04"$ListenPort = 2222$TargetPort = 22
$WslIp = (wsl -d $Distro -- hostname -I).Trim().Split(" ")[0]if (-not $WslIp) { throw "WSL IP not found." }
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=$ListenPort ` connectaddress=$WslIp connectport=$TargetPort允許埠通過 Windows 防火牆(一次性):
New-NetFirewallRule -DisplayName "WSL SSH $ListenPort" -Direction Inbound ` -Protocol TCP -LocalPort $ListenPort -Action AllowWSL 重啟後重新整理 portproxy:
netsh interface portproxy delete v4tov4 listenport=$ListenPort listenaddress=0.0.0.0 | Out-Nullnetsh interface portproxy add v4tov4 listenport=$ListenPort listenaddress=0.0.0.0 ` connectaddress=$WslIp connectport=$TargetPort | Out-Null備註:
- 從另一台機器進行 SSH 會指向 Windows 主機 IP(例如:
ssh user@windows-host -p 2222)。 - 遠端節點必須指向一個 可連線 的 Gateway URL(而不是
127.0.0.1);使用openclaw status --all進行確認。 - 使用
listenaddress=0.0.0.0進行 LAN 存取;127.0.0.1僅保留在本地。 - 如果您希望自動執行此操作,請註冊一個排程任務以在登入時執行重新整理 步驟。
WSL2 逐步安裝
Section titled “WSL2 逐步安裝”1) 安裝 WSL2 + Ubuntu
Section titled “1) 安裝 WSL2 + Ubuntu”開啟 PowerShell (系統管理員):
wsl --install# Or pick a distro explicitly:wsl --list --onlinewsl --install -d Ubuntu-24.04如果 Windows 要求,請重新開機。
2) 啟用 systemd(安裝 gateway 所需)
Section titled “2) 啟用 systemd(安裝 gateway 所需)”在您的 WSL 終端機中:
sudo tee /etc/wsl.conf >/dev/null <<'EOF'[boot]systemd=trueEOF然後從 PowerShell:
wsl --shutdown重新開啟 Ubuntu,然後驗證:
systemctl --user status3) 安裝 OpenClaw(在 WSL 內)
Section titled “3) 安裝 OpenClaw(在 WSL 內)”在 WSL 內按照 Linux 快速入門流程操作:
git clone https://github.com/openclaw/openclaw.gitcd openclawpnpm installpnpm ui:build # auto-installs UI deps on first runpnpm buildopenclaw onboard完整指南:快速入門
Windows 伴隨應用程式
Section titled “Windows 伴隨應用程式”我們尚未有 Windows 伴隨應用程式。如果您希望 貢獻使其實現,歡迎提供貢獻。