How to enable long file path names in Windows 11

Michael Winslow 0 Reputation points
2024-07-09T14:20:26.76+00:00

We are trying to access phone dumps where the path is over 255 characters long, what is Microsoft's official way of enabling this in Windows 11?

Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,952 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2024-07-09T14:20:26.79+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To enable long file path names in Windows 11, you can follow the same steps as in Windows 10. Starting in Windows 10, version 1607, MAX_PATH limitations have been removed from common Win32 file and directory functions, but you must opt-in to the new behavior. To enable the new long path behavior, both of the following conditions must be met:

    1. The registry key Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled (Type: REG_DWORD) must exist and be set to 1.
    2. The application manifest must also include the longPathAware element.

    You can also copy the code to a .reg file which can set this for you, or use the PowerShell command from a terminal window with elevated privileges. Once this feature is enabled, you must access the SMB share needs using \\?\ in the path to allow longer path lengths. This method doesn't support UNC paths, so the SMB share needs to be mapped to a drive letter.

    Here are the directory management functions that no longer have MAX_PATH restrictions if you opt-in to long path behavior: CreateDirectoryW, CreateDirectoryExW GetCurrentDirectoryW RemoveDirectoryW SetCurrentDirectoryW. These are the file management functions that no longer have MAX_PATH restrictions if you opt-in to long path behavior: CopyFileW, CopyFile2, CopyFileExW, CreateFileW, CreateFile2, CreateHardLinkW, CreateSymbolicLinkW, DeleteFileW, FindFirstFileW, FindFirstFileExW, FindNextFileW, GetFileAttributesW, GetFileAttributesExW, SetFileAttributesW, GetFullPathNameW, GetLongPathNameW, MoveFileW, MoveFileExW, MoveFileWithProgressW, ReplaceFileW, SearchPathW, FindFirstFileNameW, FindNextFileNameW, FindFirstStreamW, FindNextStreamW, GetCompressedFileSizeW, GetFinalPathNameByHandleW.


    References:

    0 comments No comments

  2. Molly Lu 766 Reputation points Microsoft Vendor
    2024-07-10T06:40:04.96+00:00

    Hello,

    Thank you for posting in Microsoft Q&A.

    Based on the description, I understand your question is related to enable long file path names.

    Type regedit into the Run dialog and hit Enter to open the Registry Editor, Navigate to the FileSystem Key:

    In the Registry Editor, go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem.

    This path takes you to the FileSystem key, where you can modify settings related to file systems.

    Modify the LongPathsEnabled Value:

    Find the LongPathsEnabled entry, double-click it, and set its value to 1.

    Changing this value may allow Windows to handle file paths longer than 260 characters.

    Close the Registry Editor and Restart:

    Close the Registry Editor and restart your computer to apply the changes.

    Have a nice day.

    Best Regards,

    Molly

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it

    0 comments No comments