Skip to content

fix(powershell): nested Join-Path for Windows PowerShell 5.1 compat#19

Merged
karlkauc merged 1 commit into
mainfrom
fix/ps-joinpath-win51-compat
May 18, 2026
Merged

fix(powershell): nested Join-Path for Windows PowerShell 5.1 compat#19
karlkauc merged 1 commit into
mainfrom
fix/ps-joinpath-win51-compat

Conversation

@karlkauc

Copy link
Copy Markdown
Contributor

Problem

Running powershell -File XSD_Validation/powershell/Validate-FundsXml.ps1
on Windows PowerShell 5.1 (powershell.exe) aborted at line 39 with:

Es wurde kein Positionsparameter gefunden, der das Argument ".." akzeptiert.
PositionalParameterNotFound,Validate-FundsXml.ps1

The script died before any parameter binding or validation ran.

Root cause

Join-Path $PSScriptRoot '..' '..' uses the 3-argument form
(-AdditionalChildPath), which is PowerShell 7+ only. Windows
PowerShell 5.1's Join-Path accepts only -Path/-ChildPath, so the
third '..' had no positional parameter to bind to. This contradicted
the script's own docstring claim of "Works in Windows PowerShell 5.1 and
PowerShell 7+".

Fix

Use nested Join-Path, which behaves identically in 5.1 and 7+:

$repoRoot = (Resolve-Path (Join-Path (Join-Path $PSScriptRoot '..') '..')).Path

Verified this was the only 3-arg Join-Path occurrence in the repo's
.ps1 files.

🤖 Generated with Claude Code

The 3-arg Join-Path form (-AdditionalChildPath) is PS 7+ only. Windows
PowerShell 5.1 (powershell.exe) rejected the third '..' with
PositionalParameterNotFound, aborting Validate-FundsXml.ps1 at line 39
before any validation ran. Nested Join-Path works in both 5.1 and 7+,
honoring the script's stated 5.1 compatibility.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@karlkauc karlkauc merged commit ce56848 into main May 18, 2026
4 checks passed
@karlkauc karlkauc deleted the fix/ps-joinpath-win51-compat branch May 18, 2026 07:35
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