Long file path issues in Windows 11 Pro with Microsoft VS Code and File Explorer

Anonymous
2022-05-04T22:27:47+00:00

I spent way too long debugging a compile error in MS VS Code (64bit version 1.66.2). It would fail with 'file not found' or 'unable to access file' errors. The workspace is located in "C:\Users\UserName\Documents\My Workspaces\firmware", with several levels of nested source folders below.

Initially, I got several linking errors due to Controlled Folder Access protection using the Ransomware protection built-in to Windows Security. I whitelisted ar.exe and as. exe, but the errors persisted. I even turned off Ransomware protection. Seeing a thread online about long file paths reminded me I hadn't enabled that on Windows 11 yet (fresh install), so I changed the following settings and rebooted the PC:
Registry: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled set to 1.

Group Policy: System "Configuration>Administrative Templates>System>Filesystem>Enable Win32 long paths" enabled.

About that time I noticed an issue with not being able to delete or rename files on an SMB share that were in a deep path. If I went to the other system and moved them up a few folders I was again able to rename the files.

Both of these scenarios work fine from my Windows 10 Pro PC. My Windows 11 Pro PC is a fresh install (Version 21H2 Build 22000.613).

So I believe Windows 11 isn't respecting my Long Paths settings. As a final test, I moved my VS Code Workspace folder to system drive root (C:\firmware) and it compiled without error.

I've seen other questions on here about Windows 11 path length issues that were brushed away because they were encountered using non-Microsoft 3rd Party software, but this is all built-in File Explorer and Microsoft's own VS Code product.

My question is, how do I actually allow long file paths in Windows 11 Pro?

Windows for home | Windows 11 | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

77 answers

Sort by: Most helpful
  1. Anonymous
    2023-05-25T15:47:11+00:00

    Microsoft doesn't read these posts. Instead, when you report a bug to them, they'll sit on their hands until they get you on the phone. Then they'll waste your time because you now have to tell them that these posts say. It's a thankless task reporting issues to Microsoft, I really don't recommend it.

    Yes, explorer doesn't do long paths, even if you enable them.

    You'll want to use a command line tool for the copy you're describing. Robocopy is the built in tool for that job that supports long path names.

    Robocopy has a gazillion parameters and is hard to get right. For these sorts of tasks, I've farmed out all those jobs to ChatGPT. I asked it to help you and it told me:

    robocopy "\?\F:\YourFolder" "\?\C:\Users\YourUserName\Desktop\YourFolder" /E

    Where f:\ is your external drive and the other folder is where you want to copy to. the \?\ is to pass a UNC, which windows likes for the long paths.

    I use robocopy all the time and that line looks about right. Depending on where you're copying to, you may want to pick an Admin console or Admin powershell. (Do NOT use a "powershell ISE" console, since that doesn't do long paths either).

    Was this answer helpful?

    4 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2022-12-20T16:48:24+00:00

    Trouble is that no one in this discussion can get long paths to work on windows 11. We can get it working great with windows 10, but no one here can get it working on Windows 11.

    If you do get it working, please let us know how.

    Was this answer helpful?

    3 people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2022-12-20T10:19:39+00:00

    I have the same problem in windows 11 fully patched. I have just enabled long paths with gpedit.msc (the Local Group Policy Editor) and restarted my PC twice, and still long names are not enabled.

    Am I skipping some step in the process?

    Thanks for your support.

    Update: after enabling longpaths with gpedit, as described above (and double-checking the enablement setting was on), I have checked the registry and I was disappointed to see that the longpath parameter was still set to 0 there. I have then set the longpath registry parameter to 1 and restarted the PC. After that it seems that longpaths are enabled. It seems that there is a disconnection between gpedit and the registry. Hope this information can help the group here.

    Was this answer helpful?

    3 people found this answer helpful.
    0 comments No comments
  4. Anonymous
    2022-12-02T18:03:11+00:00

    I actually talked with Microsoft yesterday. Apparently they needed more info before they were willing to attempt to reproduce the issue.

    So, I ran a few scripts that they gave me on a clean and fully patched Windows 11 VM. Gave them those logs and now they're looking into whether they can reproduce the issue at their end.

    Hopefully they'll make their reproduction attempt soon...

    Was this answer helpful?

    3 people found this answer helpful.
    0 comments No comments
  5. Anonymous
    2022-11-25T06:52:10+00:00

    It's quite frustrating that this is still not working. Please, let us know what you hear back from Microsoft.

    Was this answer helpful?

    3 people found this answer helpful.
    0 comments No comments