Prerequisites
Steps to reproduce
We have some old processes that build paths by concatenating strings instead of using Join-Path, and it happens that some of these paths point to folders but have a double backslash at the end instead of one. Usually the normalization should manage the double (or more) backslashes reducing them to one, but in version 7.6.0 I found a weird behavior with these unusual but valid paths.
This happens only with UNC paths. The resolution of such paths ending with two backslashes returns the first subfolder in alphabetical order contained in the intended target folder. If the path ends with n+1 backslashes, it goes n levels deep recursively.
The path normalization works as expected it there are instances of multiple backslashes in the inner parts of the path, so this is triggered only when the path is well formed except for the end.
I observed this behavior with the cmdlets Get-ChildItem (returns the content of the subfolder) and Set-Location (currend folder becomes the subfolder).
Expected behavior
C:\Temp> Get-ChildItem \\remote\TestBackslash\
Directory: \\remote\TestBackslash
Mode LastWriteTime Length Name
---- ------------- ------ ----
da--- 21/04/2026 11:59 Level1
-a--- 21/04/2026 11:59 0 TextFileRootLevel.txt
C:\Temp> Get-ChildItem \\remote\TestBackslash\\
Directory: \\remote\TestBackslash
Mode LastWriteTime Length Name
---- ------------- ------ ----
da--- 21/04/2026 11:59 Level1
-a--- 21/04/2026 11:59 0 TextFileRootLevel.txt
C:\Temp> Get-ChildItem \\remote\TestBackslash\\\
Directory: \\remote\TestBackslash
Mode LastWriteTime Length Name
---- ------------- ------ ----
da--- 21/04/2026 11:59 Level1
-a--- 21/04/2026 11:59 0 TextFileRootLevel.txt
Actual behavior
C:\Temp> Get-ChildItem \\remote\TestBackslash\
Directory: \\remote\TestBackslash
Mode LastWriteTime Length Name
---- ------------- ------ ----
da--- 21/04/2026 11:59 Level1
-a--- 21/04/2026 11:59 0 TextFileRootLevel.txt
C:\Temp> Get-ChildItem \\remote\TestBackslash\\
Directory: \\remote\TestBackslash\Level1
Mode LastWriteTime Length Name
---- ------------- ------ ----
da--- 21/04/2026 11:59 Level2
-a--- 21/04/2026 11:59 0 TextFileLevel1.txt
C:\Temp> Get-ChildItem \\remote\TestBackslash\\\
Directory: \\remote\TestBackslash\Level1\Level2
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 21/04/2026 11:59 0 TextFileLevel2.txt
Error details
Environment data
Name Value
---- -----
PSVersion 7.6.0
PSEdition Core
GitCommitId 7.6.0
OS Microsoft Windows 10.0.26200
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Prerequisites
Steps to reproduce
We have some old processes that build paths by concatenating strings instead of using
Join-Path, and it happens that some of these paths point to folders but have a double backslash at the end instead of one. Usually the normalization should manage the double (or more) backslashes reducing them to one, but in version 7.6.0 I found a weird behavior with these unusual but valid paths.This happens only with UNC paths. The resolution of such paths ending with two backslashes returns the first subfolder in alphabetical order contained in the intended target folder. If the path ends with
n+1backslashes, it goesnlevels deep recursively.The path normalization works as expected it there are instances of multiple backslashes in the inner parts of the path, so this is triggered only when the path is well formed except for the end.
I observed this behavior with the cmdlets
Get-ChildItem(returns the content of the subfolder) andSet-Location(currend folder becomes the subfolder).Expected behavior
Actual behavior
Error details
Environment data
Visuals
No response