Does registry path have limitation of MAX_PATH

Dudu 161 Reputation points
2021-05-10T17:54:16.903+00:00

Does registry path have MAX_PATH limitation like file or folder path. What is the maximum length of registry path in Windows?

Thanks.

Windows development | Windows API - Win32
Developer technologies | C++
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. RLWA32 49,636 Reputation points
    2021-05-10T18:00:21.097+00:00

  2. Song Zhu - MSFT 906 Reputation points
    2021-05-11T03:02:49.493+00:00

    According to the MSDN:

    255 characters. The key name includes the absolute path of the key in the registry, always starting at a base key, for example, HKEY_LOCAL_MACHINE.

    If you want to modify the maximum path length limit, you can refer to: Maximum Path Length Limitation

    Starting in Windows 10, version 1607, MAX_PATH limitations have been removed from common Win32 file and directory functions. However, you must opt-in to the new behavior.

    To enable the new long path behavior, both of the following conditions must be met:

    The registry key Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled (Type: REG_DWORD) must exist and be set to 1. The key's value will be cached by the system (per process) after the first call to an affected Win32 file or directory function (see below for the list of functions). The registry key will not be reloaded during the lifetime of the process. In order for all apps on the system to recognize the value of the key, a reboot might be required because some processes may have started before the key was set.


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

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

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