Skip to content

/cwd does not strip surrounding quotes from pasted Windows paths (Explorer "Copy as path") #4426

Description

@TheDeuceYouSay

Description

When pasting a Windows path that is wrapped in double quotes (the format produced by Windows Explorer's Copy as path, e.g. "C:\Users\me\My Folder"), the /cwd command treats the quotes as literal characters. The quoted string is then interpreted as a relative path and appended to the current working directory, so the command fails even though the target directory exists.

Steps to reproduce

  1. In Windows Explorer, right-click a folder → Copy as path (yields a quoted path like "C:\Users\russell.adams\OneDrive - Layfield Group\Scripts\LFG Efforts\CMMC").
  2. In Copilot CLI, type /cwd and paste.

Actual behavior

Failed to change directory: Error: Directory does not exist or cannot be accessed: C:\Users\russell.adams\"C:\Users\russell.adams\OneDrive - Layfield Group\Scripts\LFG Efforts\CMMC"

The quoted absolute path is concatenated onto the current cwd instead of being recognized as an absolute path.

Expected behavior

/cwd should strip surrounding single/double quotes from the argument before resolving it, so paths pasted via "Copy as path" work directly. (Unquoted paths with spaces already work fine.)

Environment

  • Copilot CLI version: 1.0.78
  • OS: Windows (Windows_NT)

Workaround

Manually delete the surrounding quotes before submitting the /cwd command.

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