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.exeis legacy Windows PowerShell 5.1.pwshhas 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.exepreserves compatibility for machines wherepwshis not installed. - Users who specifically need legacy Windows PowerShell can still opt into it explicitly.
Suggested behavior
- On Windows, resolve
pwshfirst fromPATHor known install locations. - If found, use
pwshfor shell tool calls. - If not found, fall back to
powershell.exe. - Optionally expose an explicit config override such as
windows.shell_pathorwindows.shell = "pwsh" | "powershell".
This would make the Windows default safer and more modern without breaking older environments.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗