Skip to content

Get-Item with a drive's root dir stringifies incorrectly #10956

@mklement0

Description

@mklement0

This is a regression from Windows PowerShell.

When accessing a drive's root directory, an extra path separator is appended on stringification.

Steps to reproduce

$root = ('/', 'C:\')[$env:OS -eq 'Windows_NT']
Push-Location ('/', 'C:\')[$env:OS -eq 'Windows_NT']

(Get-Item /).ToString() | Should -Be $root
(Get-Item .).ToString() | Should -Be $root

Pop-Location 

Expected behavior

The tests should pass.

Actual behavior

The tests fails; e.g., on Windows:

Expected: 'C:\'
But was:  'C:\\'

Environment data

PowerShell Core 7.0.0-preview.5

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.WG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions