Share via

using "\\?\" prefix

Chitchai Hemachudha 0 Reputation points
2026-03-16T07:25:15.34+00:00

using "\?" prefix with robocopy command in CMD on windows server 2019 received error "the system cannot find path".

Windows for business | Windows Server | User experience | PowerShell
{count} votes

2 answers

Sort by: Most helpful
  1. MotoX80 37,351 Reputation points
    2026-03-16T14:27:23.5733333+00:00

    Robocopy supports long file names by default. You don't need to use the "\\?\C:" notation.

    On Win11, I was able to recreate your error and found that I needed to disable long file name support in robocopy in order to get it to work.

    robocopy "\\?\D:\robocopyX.txt" "\\?\E:\robocopyX.txt" /e /256 /l 
    robocopy "D:\robocopyX.txt" "E:\robocopyX.txt" /e /l
    robocopy /? | findstr.exe 256
    
    0 comments No comments

  2. Q&A Assist
    2026-03-16T07:25:27.76+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    \\?\ is the Win32 file namespace prefix that allows paths longer than 260 characters and disables some path normalization. When this prefix is used, the entire path must be syntactically correct and fully qualified, and every space or special character must be handled exactly as required by the command-line parser.

    For robocopy specifically, the common causes of The system cannot find the path specified when using \\?\ are:

    1. Missing quotation marks around paths that contain spaces
      • At the command prompt, long paths or paths with spaces must be enclosed in double quotes, otherwise the command interpreter splits them at spaces and robocopy receives an invalid path.
      • Example of incorrect usage:
             robocopy \\?\C:\My Long Path With Spaces \\?\D:\Backup Folder
        
      • Correct usage with quotes:
             robocopy "\\?\C:\My Long Path With Spaces" "\\?\D:\Backup Folder" /e
        
      • This follows the same rule as other commands: paths with spaces require quotation marks.
    2. Incorrect path form with \\?\
      • The \\?\ prefix must be followed by a fully qualified local path, for example:
        • \\?\C:\folder\subfolder (local drive)
      • UNC long paths use \\?\UNC\server\share\folder, not \\?\\server\share.
      • If the prefix is applied incorrectly (for example, missing drive letter or using the wrong UNC form), robocopy cannot resolve the path and returns the error.
    3. Root paths and attributes
      • When copying from the root of a device, robocopy can apply hidden/system attributes to the destination root. Ensure the path actually exists and is accessible before adding \\?\.

    To resolve the error:

    1. Enclose both source and destination in double quotes whenever they contain spaces or special characters:
         robocopy "\\?\C:\Source Folder" "\\?\D:\Destination Folder" /e
      
    2. Verify that the path exists without \\?\ first (e.g., C:\Source Folder), then add the prefix.
    3. Ensure the \\?\ form is correct (local vs UNC) and fully qualified.

    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.