Long paths not working in windows 2019

Bhaskar Venkatesha 1 Reputation point
2022-02-14T04:57:56.393+00:00

Followed the steps given below to enable long paths and rebooted the machine

Press Win + R keys on your keyboard and type regedit then press Enter. Registry Editor will be opened.

Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem.

Edit LongPathsEnabled and set it to 1.

Press Win + R keys on your keyboard and type gpedit.msc then press Enter. Group Policy Editor will be opened.

Go to Local Computer Policy -> Computer Configuration -> Administrative Templates -> System -> Filesystem, then enable the Enable Win32 long paths option.
6.Restart machine.

Executed the below program to check if the file gets created in the already existing folder structure C:\abcdefghijklmnopqrstuvwxyz\abcdefghijklmnopqrstuvwxyz\abcdefghijklmnopqrstuvwxyz\abcdefghijklmnopqrstuvwxyz\abcdefghijklmnopqrstuvwxyz\abcdefghijklmnopqrstuvwxyz\abcdefghijklmnopqrstuvwxyz\abcdefghijklmnopqrstuvwxyz\abcdefghijklmnopqrstuvwxyz

int main()
{
HANDLE h = CreateFileA(
"C:\abcdefghijklmnopqrstuvwxyz\abcdefghijklmnopqrstuvwxyz\abcdefghijklmnopqrstuvwxyz\abcdefghijklmnopqrstuvwxyz\abcdefghijklmnopqrstuvwxyz\abcdefghijklmnopqrstuvwxyz\abcdefghijklmnopqrstuvwxyz\abcdefghijklmnopqrstuvwxyz\abcdefghijklmnopqrstuvwxyz\012345678901234567890123456789.txt",
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
CREATE_NEW,
FILE_ATTRIBUTE_TEMPORARY,
NULL);

if (h == INVALID_HANDLE_VALUE) { DWORD err = GetLastError(); printf("err %dn", err); getchar(); return 1; }
printf("Created\n");
getchar();

return 0;
}

The above program failed to create the file and produced the following output
err 3

The same program worked in windows 2016

What additional thing needs to be done in windows 2019 for long paths to work?

Machine details
Windows server 2019
Microsoft windows Server
Version 1809 (OS build 17763.316)

Windows Server 2019
Windows Server 2019
A Microsoft server operating system that supports enterprise-level management updated to data storage.
3,451 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,111 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Sreeju Nair 11,606 Reputation points
    2022-02-14T05:08:19.293+00:00

    Based on your question, it seems the group policy update is not reflected yet. Did you try gpupdate after updating the value? You may also try gpupdate /force to ensure the policy settings are reapplied.


  2. Limitless Technology 43,931 Reputation points
    2022-02-18T15:46:47.897+00:00

    Hello @Bhaskar Venkatesha

    You can try using the PowerShell command from a terminal window with elevated privileges and see if that helps you.

    New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
    -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force

    Some users have also found that extract target path was using '/' instead of '\' in server 2019 and changing this back has sorted the issue for them.

    Here is a thread as well that discusses the same issue and you can try out some troubleshooting steps from this and see if that helps you to sort the Issue.

    Windows Server Long Path Name Support (2016 vs 2019)
    https://answers.microsoft.com/en-us/windows/forum/all/windows-server-long-path-name-support-2016-vs-2019/cc07d2f0-5700-4484-87fa-a24bdaa24781
    Hope this resolves your Query!!

    --
    --If the reply is helpful, please Upvote and Accept it as an answer--

    0 comments No comments