Prerequisites
Steps to reproduce
This is a sub-issue of #25242.
The cmdlet Split-Path does not respect explicit $false values for the -Qualifier, -NoQualifier, -Leaf, and -IsAbsolute switch parameters.
PS> Split-Path -Path 'C:\Windows\System32\notepad.exe' -Qualifier:$false
PS> Split-Path -Path 'C:\Windows\System32\notepad.exe' -NoQualifier:$false
PS> Split-Path -Path 'C:\Windows\System32\notepad.exe' -Leaf:$false
PS> Split-Path -Path 'C:\Windows\System32\notepad.exe' -IsAbsolute:$false
Expected behavior
PS> Split-Path -Path 'C:\Windows\System32\notepad.exe' -Qualifier:$false
C:\Windows\System32
PS> Split-Path -Path 'C:\Windows\System32\notepad.exe' -NoQualifier:$false
C:\Windows\System32
PS> Split-Path -Path 'C:\Windows\System32\notepad.exe' -Leaf:$false
C:\Windows\System32
PS> Split-Path -Path 'C:\Windows\System32\notepad.exe' -IsAbsolute:$false
C:\Windows\System32
Each parameter with :$false should behave the same as omitting the switch, returning the parent directory path.
Actual behavior
PS> Split-Path -Path 'C:\Windows\System32\notepad.exe' -Qualifier:$false
C:
PS> Split-Path -Path 'C:\Windows\System32\notepad.exe' -NoQualifier:$false
\Windows\System32\notepad.exe
PS> Split-Path -Path 'C:\Windows\System32\notepad.exe' -Leaf:$false
notepad.exe
PS> Split-Path -Path 'C:\Windows\System32\notepad.exe' -IsAbsolute:$false
True
Each parameter with :$false behaves the same as specifying the switch with :$true, incorrectly applying the switch's behavior instead of ignoring it.
Error details
No error is thrown. The cmdlet executes but ignores the explicit $false values.
Environment data
PS> $PSVersionTable
Name Value
---- -----
PSVersion 7.5.4
PSEdition Core
GitCommitId 7.5.4
OS Microsoft Windows 10.0.26100
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Prerequisites
Steps to reproduce
This is a sub-issue of #25242.
The cmdlet
Split-Pathdoes not respect explicit$falsevalues for the-Qualifier,-NoQualifier,-Leaf, and-IsAbsoluteswitch parameters.Expected behavior
Each parameter with
:$falseshould behave the same as omitting the switch, returning the parent directory path.Actual behavior
Each parameter with
:$falsebehaves the same as specifying the switch with:$true, incorrectly applying the switch's behavior instead of ignoring it.Error details
No error is thrown. The cmdlet executes but ignores the explicit
$falsevalues.Environment data
Visuals
No response