anthropics / anthropics/claude-code

C:/Program Files/Git/desktop always reports "not installed" on Windows even when Claude Desktop is installed (reg.exe arg escaping bug)

未关闭
#89,553 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area:desktop bug has repro platform:windows
主要语言
Python
星标
145k
派生
23.1k
PR 合并指标
PR 指标待抓取

描述

## Bug description

On Windows, the `/desktop` command always reports the desktop app as "not installed" / prompts to download it, even when Claude Desktop is genuinely installed and running, and even when the OS-level `claude://` URI handler is correctly registered and functional.

## Environment

- Claude Code version: 2.1.245 (Windows build)
- OS: Windows 11 Home 10.0.26200
- Claude Desktop: installed and running (confirmed two valid installs present — a Squirrel-installed copy under `%LOCALAPPDATA%\AnthropicClaude` and a Microsoft Store/MSIX package `Claude_1.34493.1.0_x64`)

## Root cause (found via reverse-inspection of the shipped binary)

The Windows install-check in `/desktop` shells out to:

```
reg query "HKEY_CLASSES_ROOT\claude" /ve
```

Manually running this exact command succeeds (exit code 0) every time, using several different spawn methods (PowerShell, `cmd /c`, Python `subprocess.run` with an argv list, with a normal environment, and with a stripped-down environment).

However, I was able to reproduce the exact failure mode (`ERROR: Invalid key name.`, exit code 1) by passing the registry path with a **doubled backslash** instead of a single one:

```
reg query "HKEY_CLASSES_ROOT\claude" /ve # fails: Invalid key name
reg query "HKEY_CLASSES_ROOT\claude" /ve # succeeds
```

This strongly suggests that whatever spawns `reg.exe` internally (this build appears to be a Bun-compiled binary) is double-escaping the backslash in the quoted registry path argument on Windows, causing the install check to always fail and report "not installed," regardless of actual installation state.

## Steps to reproduce

1. On Windows, install Claude Desktop.
2. In Claude Code, run `/desktop`.
3. Observe: it reports the app is not installed / offers to download it, even though it is installed and running.

## Expected behavior

`/desktop` should correctly detect an installed Claude Desktop app on Windows and hand off the session, instead of always falling through to the "not installed" / download-prompt path.

## Suggested fix

Verify how the internal process-spawn helper constructs the Windows command line for arguments containing backslashes inside quotes (likely a Bun `spawn`/`spawnSync` argv-escaping issue specific to Windows), and/or avoid backslash-in-quotes registry paths by using `reg.exe`'s alternate forms, or a native Windows registry API instead of shelling out to `reg.exe`.

贡献指南

这个仓库没有索引到贡献指南

调研方向

Trace the Windows install-check used by /desktop and the process-spawn helper that runs reg.exe. Reproduce the quoted HKEY_CLASSES_ROOT\claude query on Windows and compare the argument escaping and exit status; done means an installed Claude Desktop is detected and /desktop hands off instead of prompting for download.

由索引模型根据 Issue 内容生成。

评估

技术栈
bun
领域
cli, operating-systems
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。