/desktop fails on Windows: deep-link URL split on ampersand by cmd.exe
/desktop fails on Windows — deep-link URL is split on & by cmd.exe
Summary
On Windows, the /desktop (alias /app) slash command always fails with:
Error: Failed to open Claude Desktop. Please try opening it manually.
The error message is misleading. The Claude Desktop app, the claude:// protocol handler, and authentication are all correct. The actual problem is that the CLI launches the claude://resume?session=…&cwd=… deep link through cmd.exe, which interprets the unescaped & as a command separator. The URL is split in half, so an incomplete link is dispatched and the handoff fails.
Environment
- OS: Windows 11 Pro (10.0.26200)
- Claude Code: 2.1.168 (native installer,
%USERPROFILE%\.local\bin\claude.exe) - Claude Desktop: 1.11187.4.0 (installed,
Status: Ok) - Shell: PowerShell
Verified: setup is correct
Protocol handler is registered and points to a valid exe:
HKCU:\Software\Classes\claude -> "C:\Program Files\WindowsApps\Claude_1.11187.4.0_x64__pzs8sxrjxfjjc\app\Claude.exe" "%1"
HKCU:\Software\Classes\claude-cli -> "C:\Users\<user>\.local\bin\claude.exe" --handle-uri "%1"
Root cause (minimal repro)
The deep link contains &. When passed through cmd.exe, it splits:
PS> cmd /c "echo claude://resume?session=ABC123&cwd=C:\Users\me"
claude://resume?session=ABC123
'cwd' is not recognized as an internal or external command,
operable program or batch file.
So the launcher effectively runs:
start "" "claude://resume?session=ABC123"← incomplete URL → fails to resolvecwd=C:\Users\me← treated as a separate command → error (swallowed)
Result: "Failed to open Claude Desktop."
Confirmation that the handoff target works
Launching the same URL via a method that does not let cmd.exe re-parse it succeeds and opens the session in the desktop app:
$session = '<session-id>'
$cwd = [uri]::EscapeDataString('D:\Claude Code')
Start-Process "claude://resume?session=$session&cwd=$cwd" # works, desktop app resumes the session
Expected behavior
/desktop opens the Claude Desktop app and resumes the current session.
Suggested fix
On Windows, don't route the deep link through cmd /c start "…" with an unescaped URL. Either:
- launch it without a shell (e.g. spawn with
shell: false), or - use PowerShell
Start-Process "<url>", or - escape
&as^&for the cmd path.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗