Skip to content

Copilot CLI internal PowerShell tool fails to spawn pwsh.exe on Windows (ENOENT) #2355

Open

Description

@akumaxd18

Describe the bug

The Copilot CLI works correctly for interactive prompts, but its internal PowerShell tool runtime fails to execute pwsh.exe on this Windows machine.
PowerShell 7 is installed, accessible, and resolves correctly via PATH. The failure is limited to Copilot CLI’s internal command execution (Node.js spawn).
This appears to be a Copilot CLI tool runtime issue rather than an environment misconfiguration.

Affected version

Copilot CLI: v1.0.12 installed via winget

Steps to reproduce the behavior

Steps to Reproduce

Install PowerShell 7.6.0 via winget
Ensure pwsh.exe is accessible via PATH
Install Copilot CLI via winget
Run a Copilot CLI workflow that requires internal PowerShell execution

Expected behavior

Copilot CLI should be able to spawn pwsh.exe and execute PowerShell commands successfully.

Additional context

The following commands work correctly when executed directly in PowerShell:
where pwsh
(Get-Command pwsh).Source

Both resolve to:
C:\Program Files\PowerShell\7\pwsh.exe
pwsh -NoLogo -Command "$PSVersionTable.PSVersion"

Environment

OS: Windows (64-bit)
Copilot CLI: v1.0.12 installed via winget
Installation type: WinGet / MSIX
PowerShell: 7.6.0 (x64)

Installation path: C:\Program Files\PowerShell\7\pwsh.exe
PowerShell x86 was removed to avoid multi-architecture conflicts
The issue persists even with a clean PATH and fresh sessions
This suggests a Copilot CLI internal tool runtime / MSIX sandbox limitation
Junctions and PATH fixes do not resolve the issue

Activity

  1. added theissue type on Mar 28, 2026
  2. iArxic commented on Mar 30, 2026

    @iArxic

    yeah

  3. myth384 commented on Apr 2, 2026

    @myth384

    The reported issue appears to be related to the ACP CoPilot plugin being unable to execute pwsh commands. We are experiencing this problem on all JetBrains Rider installations. PowerShell 7.6.0 is installed on every machine and is available in the path environment variables. Other ACP plugins we use are able to execute pwsh commands without any issues.

  4. mbaker-prgs commented on Apr 3, 2026

    @mbaker-prgs

    Microsoft puts these 0 byte redirect files in the %AppData%\Microsoft\WindowsApps folder which is using copilot CLI to fail to launch pwsh.exe.

  5. added
    area:non-interactiveNon-interactive mode (-p), CI/CD, ACP protocol, and headless automation
    on Apr 6, 2026
  6. Xorpio commented on May 7, 2026

    @Xorpio

    Confirming Same Issue

    I can confirm I'm experiencing the same issue with Copilot CLI being unable to spawn pwsh.exe.

    Environment Details

    • Copilot CLI Version: v1.0.43
    • OS: Windows 11
    • Installation Method: winget
    • PowerShell 7.6

    Error Observed

    When attempting to use Copilot CLI commands that require PowerShell execution, I receive:

    Error: PowerShell 6+ (pwsh) is not available. Please install it from https://aka.ms/powershell. Error: Command failed: pwsh.exe --version 'pwsh.exe' is not recognized as an internal or external command, operable program or batch
    file.

    PowerShell Verification

    When I manually check PowerShell availability in my terminal:

    • pwsh --version → PowerShell 7.6.1
    • (Get-Command pwsh).Source → C:\Program Files\PowerShell\7\pwsh.exe

    Additional Context

    • The error occurs specifically when Copilot CLI tries to execute internal PowerShell commands
    • Direct PowerShell execution works fine outside of Copilot CLI
    • This appears to be a Copilot CLI internal tool runtime issue rather than a PowerShell installation problem
    • Matches the behavior described in the original issue where PATH resolution works but Node.js spawn fails

    Impact

    This prevents me from using any Copilot CLI features that require PowerShell execution, significantly limiting the tool's functionality on Windows.

  7. sawa-ko commented on May 21, 2026

    @sawa-ko

    Same issue here as Xorpio.

  8. OndrejKut commented on Jun 2, 2026

    @OndrejKut

    Still broken, is there any plan to fix this? Github copilot is unusable because of this.

  9. patniko commented on Oct 26, 2026

    @patniko
    Collaborator

    Thanks for the report. We've shipped fixes in this area since this was filed (most recently in Copilot CLI v1.0.93), and we believe this may now be resolved. Could you retest on the latest release (Copilot CLI v1.0.103) and let us know whether you still see it? If we don't hear back in a couple of weeks, we may close this issue — you can always reopen it.

    Triaged as part of a Copilot SDK backlog review, with help from GitHub Copilot.

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:non-interactiveNon-interactive mode (-p), CI/CD, ACP protocol, and headless automationarea:platform-windowsWindows-specific: PowerShell, cmd, Git Bash, WSL, Windows Terminalmore-info-needed

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions