Search code examples
windowscmd

Where is the use of "\\?\" defined?


This command is to delete all files and sub-folders in a folder

rd /s "\\?\D:\TestFolder

This command snippet got from a youtube video right here

Could someone explain what this, \\?\, does?


Solution

  • It's the prefix to bypass Windows path normalization. With it you'll be able to access paths that are not valid in Win32 namespace like names ending with . or spaces: D:\TestFolder\folder ending with space \file name ending with dot., or files with path longer than MAX_PATH (260 characters in older Windows)

    For file I/O, the "\\?\" prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system. For example, if the file system supports large paths and file names, you can exceed the MAX_PATH limits that are otherwise enforced by the Windows APIs. For more information about the normal maximum path limitation, see the previous section Maximum Path Length Limitation.

    Naming Files, Paths, and Namespaces - Win32 File Namespaces

    See