fix: use nested Join-Path for PowerShell 5.1 compatibility#593
Merged
danielmeppiel merged 3 commits intomicrosoft:mainfrom Apr 6, 2026
Merged
Conversation
PowerShell 5.1 (Windows default) only accepts two positional arguments for Join-Path. Calls with 3+ segments (e.g. Join-Path A B C) require PowerShell 6+, causing runtime setup to abort immediately on standard Windows installations. Replace all multi-argument Join-Path calls with nested two-argument calls that work on both PowerShell 5.1 and 7+. Fixes microsoft#592
This was referenced Apr 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #592
apm runtime setupfails immediately on Windows with the default PowerShell 5.1 because the setup scripts callJoin-Pathwith three or more positional path segments -- a syntax that requires PowerShell 6.0+.Windows ships with PowerShell 5.1 as the default shell. Users who have not separately installed PowerShell 7+ cannot set up any runtime.
The fix replaces every multi-segment
Join-Pathcall with nested two-argument calls, which are compatible with both PowerShell 5.1 and 7+:Type of change
Testing
Confirmed on Windows 11 Pro with PowerShell 5.1.26100.x:
Join-Path A B CraisesPositionalParameterNotFoundon PS 5.1)