Skip to content

Support $env:EDITOR being a .bat/.cmd script on Windows #1882

Description

@chwarr

Describe the feature or problem you'd like to solve

I would like to use an external editor via Ctrl-G. My external editor is opened via a wrapper Batch script

Proposed solution

Support external editors that are started via Batch (.bat/.cmd) scripts on Windows.

Example prompts or workflows

$env:EDITOR='my-editor.cmd'
copilot
# When Copilot launches, press Ctrl-G to edit the prompt in the external editor

Additional context

Today, GitHub Copilot CLI does not support your external editor being a Batch (.bat/.cmd) script. If your $env:EDITOR is something like "my-editor.cmd", pressing Ctrl-G fails with "Error: spawn EINVAL".

If $env:EDITOR is an executable, it works fine.

Activity

  1. added theissue type on Mar 7, 2026
  2. mu88 commented on Apr 13, 2026

    @mu88

    Thx for filing this issue - I also stumbled over it today when trying to configure VS Code

  3. ccstr commented on May 8, 2026

    @ccstr

    Cross-referencing anthropics/claude-code#57215 — same root cause in another major Windows TUI consumer.

    Since Node 18.20.0 / 20.12.0 / 21.7.0 (CVE-2024-27980, April 2024), child_process.spawn('<file>.cmd', ...) synchronously throws EINVAL unless shell: true is passed. A one-line fix on the Ctrl+G launch path covers .cmd and .bat together without per-extension logic:

    // instead of: spawn(editor, args)
    spawn(editor, args, { shell: true })
    // or, with explicit dispatch:
    spawn('cmd', ['/c', editor, ...args])

    (Anthropic's claude-code LSP-spawn paths got this same fix for the same root cause: anthropics/claude-code#27061, #51191, #53814.)

    Worth re-framing this as a bug rather than a feature request — npm-installed editors always end in .cmd on Windows, so any global npm bin used as $EDITOR errors out with Error: spawn EINVAL on Node ≥ 18.20.0.

  4. priyankvora257 commented on May 19, 2026

    @priyankvora257

    thanks for filing an issue, I have the same problem, do we know what is their cadence in terms of fixing and releasing new version.

  5. copilot-cli-bot commented on Sep 16, 2026

    @copilot-cli-bot

    This appears to be resolved as of GitHub Copilot CLI v1.0.85. Please update to that release or a newer stable version. We're closing this as completed. If it still happens, please comment with your version and reproduction steps.

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:platform-windowsWindows-specific: PowerShell, cmd, Git Bash, WSL, Windows Terminal

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions