Skip to content

WSL: clipboard write via clip.exe fails (quoted path in cmd /c), mouse selection copies nothing #5271

Open

Description

@aidoan-ifl

Version: 1.0.105 (also seen on 1.0.104)
Environment: WSL2 (Ubuntu 26.04) + WSLg, GNOME Console (VTE, no OSC 52 support)

Problem
Selecting text with the mouse and copying leaves the clipboard empty. /copy works.

Logs
writeToClipboard: clip.exe failed; relied on OSC 52: Error: clip.exe exited with code 1

Root cause
On WSL the CLI spawns cmd.exe /d /c 'chcp 65001 >nul & "<path>\clip.exe"'. The quotes around the path get escaped when launched from WSL, and cmd reports:
'\"C:\Windows\System32\clip.exe\"' is not recognized as an internal or external command
so it exits with code 1. The CLI then falls back to OSC 52, which VTE terminals ignore, so nothing reaches the clipboard.

Verification
Running the same command without the quotes around the clip.exe path exits 0 and the text lands on the Windows clipboard.

Workaround
Remove the quotes around ${n} in the chcp 65001 >nul & "${n}" template in cli-main.js.

Suggested fix
Don't quote the path (or escape it correctly for WSL interop), or invoke clip.exe directly instead of via cmd /c.

Activity

  1. added
    area:input-keyboardKeyboard shortcuts, keybindings, copy/paste, clipboard, mouse, and text input
    area:platform-windowsWindows-specific: PowerShell, cmd, Git Bash, WSL, Windows Terminal
    and removed on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:input-keyboardKeyboard shortcuts, keybindings, copy/paste, clipboard, mouse, and text inputarea:platform-windowsWindows-specific: PowerShell, cmd, Git Bash, WSL, Windows Terminal

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions