Skip to content

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

Open

Description

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

Activity

  1. changed the title [-]Cannot use disk root prefixed with Windows file namespace (\\.\C:\)[/-] [+]Cannot use disk root prefixed with Windows file namespace (\\?\C:\ or \\.\C:\)[/+] on Feb 13, 2018
  2. added
    Issue-Discussion
    WG-Engine-Providers
    on Feb 13, 2018
  3. DHowett commented on Feb 17, 2018

    @DHowett

    It does, however, work with -LiteralPath.

    (libra) ~ % Set-Location -LiteralPath "\\?\C:\"
    (libra) \\?\C:\ % gi .
    
    \\?
    
    d--hs-        2/15/2018   5:45 PM                \\?\C:\
    
    
    (libra) \\?\C:\ % Get-ChildItem -LiteralPath "\\?\Volume{8c2cd5c6-7a2e-4004-92cd-df850828d9b6}\"
    
    \\?\Volume{8c2cd5c6-7a2e-4004-92cd-df850828d9b6}
    
    d-----        10/2/2017   1:13 PM                Recovery
    
  4. iSazonov commented on Nov 23, 2021

    @iSazonov
    Collaborator

    Related #10805

  5. added
    Area-FileSystem-Provider
    on Nov 23, 2021
  6. added
    Resolution-No Activity
    on Nov 16, 2023
  7. ForNeVeR commented on Nov 16, 2023

    @ForNeVeR
    ContributorAuthor

    In modern PowerShell, it stopped working at all, nor \\.\C:\ neither \\.\C:\Windows work now. -LiteralPath also doesn't work.

    Not sure if it should be so or not?

  8. removed
    Resolution-No Activity
    on Nov 16, 2023
  9. added
    Resolution-No Activity
    on May 14, 2024
  10. ForNeVeR commented on May 14, 2024

    @ForNeVeR
    ContributorAuthor

    Small update: Get-ChildItem \\.\C:\ now works. Everything else is still broken as I described.

  11. removed
    Resolution-No Activity
    on May 14, 2024
  12. added
    Resolution-No Activity
    on Nov 11, 2024
  13. ForNeVeR commented on Nov 11, 2024

    @ForNeVeR
    ContributorAuthor

    I am so sorry but this is still broken, the issue still exists :(

  14. removed
    Resolution-No Activity
    on Nov 11, 2024
  15. added
    Resolution-No Activity
    on May 10, 2025
  16. ForNeVeR commented on May 10, 2025

    @ForNeVeR
    ContributorAuthor

    I am unhappy with this robot trying to close valid bug reports, and I will not surrender. Just re-checked on 7.5.1 and the issue is still present.

  17. removed
    Resolution-No Activity
    on May 10, 2025
  18. added
    Needs-Triage
    on May 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-FileSystem-ProviderIssue-DiscussionNeeds-TriageWG-Engine-Providers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions