Skip to content

Cannot use disk root prefixed with Windows file namespace (\\?\C:\ or \\.\C:\) #6149

@ForNeVeR

Description

@ForNeVeR

Steps to reproduce

NOTE: it works the same for \\?\C:\ and \\.\C:\.

$ Set-Location \\.\C:\
Set-Location : An object at the specified path \\.\C: does not exist.
At line:1 char:1
+ set-location \\.\C:\
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (:) [Set-Location], PSArgumentException
+ FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.SetLocationCommand
$ Set-Location \\.\C:\Windows # this works
$ Set-Location ..
Set-Location : Cannot find path '\\C:' because it does not exist.
At line:1 char:1
+ Set-Location ..
+ ~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (\\C::String) [Set-Location], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

It doesn't work with Get-ChildItem either: Get-ChildItem \\.\C:\ throws an error and Get-ChildItem \\?\C:\ returns an empty list. It may be a separate issue.

Expected behavior

It should work and set the current location to C:\. Notably, the following works in cmd:

$ dir \\?\C:\
 Volume in drive \\?\C: is SSD
 Volume Serial Number is 6666-СССС

 Directory of \\?\C:

05.01.2018  17:01    <DIR>          .conan
...

Actual behavior

It doesn't work.

Environment data

$ $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.0
PSEdition                      Core
GitCommitId                    v6.0.0
OS                             Microsoft Windows 10.0.16299
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-FileSystem-Providerspecific to the FileSystem providerIssue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifNeeds-TriageThe issue is new and needs to be triaged by a work group.WG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions