Skip to content

Prefer PowerShell 7 in Cmder profiles and pwsh - #3144

Open
DRSDavidSoft wants to merge 3 commits into
mainfrom
feature/prefer-powershell7
Open

DRSDavidSoft wants to merge 3 commits into
mainfrom
feature/prefer-powershell7

Conversation

@DRSDavidSoft

@DRSDavidSoft DRSDavidSoft commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

The default PowerShell profiles and pwsh alias currently launch Windows PowerShell even when PowerShell 7 is installed. This changes the normal and administrator Cmder profiles in ConEmu and Windows Terminal, the command alias, and the launcher's terminal-free PowerShell task to use one shared host selector.

  • Prefer the stable Program Files PowerShell 7 installation, including the native installation from a 32-bit process. Then check pwsh.exe applications on PATH, requiring PowerShell 7 or later. Fall back to Windows PowerShell when none is available.
  • Load Cmder's profile for an interactive session, keeping the working directory and separate user configuration. Explicit alias arguments such as pwsh -Version, -File, or -Command keep native CLI behavior and return the child's exit code.
  • Preserve existing customized settings and aliases. The README explains how to update only the PowerShell profile commands and pwsh= entry. The explicitly named Windows PowerShell profile still selects that shell.

Validation: 48 assertions passed in each of Windows PowerShell 5.1 and PowerShell 7, covering installed and portable discovery, skipping PowerShell 6 and current-directory executables, both terminal profiles and administrator command forms with delayed expansion initially enabled, CLI arguments, exit codes, separate configuration, and paths with spaces, &, apostrophes, and paired !name! segments. The path regression test also fails when the production /v:off override is removed. Real Windows PowerShell and PowerShell 7 loaded an isolated profile successfully. Win32/x64 launcher regression tests, all four native launcher build configurations, the integrated -Compile -NoVendor build, vendor-update smoke test, actionlint, and whitespace checks passed. All nine archive variants from the production packer preserved the exact built launcher and PowerShell profile payload in both shells, using synthetic vendor fixtures with integrity, vendor-selection, private-config exclusion, and SHA-256 checks. CI runs the host-selection tests in both PowerShell versions.

Selection follows Microsoft's PowerShell installation locations. Terminal GUI and elevated interactive sessions remain separate acceptance checks; these tests execute the shipped command forms without elevating or changing user settings.

@DRSDavidSoft DRSDavidSoft self-assigned this Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant