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: Oldest
  1. Igor Leyko 112.4K Reputation points Independent Advisor
    2022-05-04T23:01:09+00:00

    Hi,

    My name is Igor, I have 12 Microsoft MVP awards. It's a pleasure for me to help others and I'll do all my best to help you. I'm sorry you have a problems.

    Questions about programming it is more effective to ask at Q&A forum https://docs.microsoft.com/en-us/answers/index....

    It is oriented to programmers, admins and corporate users, and this forum - to home users so local experts may have no corresponding knowledge, sorry.

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2022-06-08T18:07:36+00:00

    This issue is not a programming issue. It's a Files/Folder and storage issue with windows 11. I can't enable long path name support in Windows 11 either. I used to be able to open/save files with really deep folder names. (more than 260 bytes). But with Windows 11 I have tried enabling long path name support with the registry setting and the group policy setting without success. (yes, I tried rebooting a few times)

    What's the scoop with Windows 11? Why does enabling the long path support in windows 11 not work?

    Was this answer helpful?

    30+ people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2022-08-10T23:19:50+00:00

    Andy Milne1's right, it's a fundamental problem in Windows 11.

    I have come across this problem in a client's new Windows 11 installation. This is occuring inside a local Onedrive folder but we can get around it by creating the folder online, which then replicates successfully to the local Onedrive folder. The weird thing is that they can then use File Explorer to create files inside that folder without that error.

    This is already enabled in Registry: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled set to 1.

    I haven't tried the Group Policy setting yet but accourding to CyberGuyTX that doesn't work either.

    Was this answer helpful?

    10+ people found this answer helpful.
    0 comments No comments
  4. Anonymous
    2022-10-15T11:09:38+00:00

    You're right. Even today (October 2022) this issue isn't fixed. I'm downgrading to Windows 10 because of this.

    Was this answer helpful?

    20+ people found this answer helpful.
    0 comments No comments
  5. Anonymous
    2022-11-09T18:27:58+00:00

    Yeah, This does not work on Windows 11 or Server 2022.

    Was this answer helpful?

    7 people found this answer helpful.
    0 comments No comments