Windows Codex should prefer pwsh over legacy powershell.exe

Open 💬 1 comment Opened Jun 10, 2026 by rockeet

Summary

On native Windows, Codex should prefer PowerShell 7 (pwsh) as the default shell when it is available, and only fall back to legacy Windows PowerShell (powershell.exe) when pwsh cannot be resolved.

Rationale

  • powershell.exe is legacy Windows PowerShell 5.1.
  • pwsh has better UTF-8 behavior by default, reducing encoding corruption when reading or writing source files.
  • PowerShell 7 is the modern cross-platform PowerShell runtime and better matches current Windows developer environments.
  • Falling back to powershell.exe preserves compatibility for machines where pwsh is not installed.
  • Users who specifically need legacy Windows PowerShell can still opt into it explicitly.

Suggested behavior

  1. On Windows, resolve pwsh first from PATH or known install locations.
  2. If found, use pwsh for shell tool calls.
  3. If not found, fall back to powershell.exe.
  4. Optionally expose an explicit config override such as windows.shell_path or windows.shell = "pwsh" | "powershell".

This would make the Windows default safer and more modern without breaking older environments.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗