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. Les Ferch 10,361 Reputation points Volunteer Moderator
    2024-02-06T16:27:13+00:00

    i tried all available solution but problem still presist

    Are you referring to a long path issue specific to VS Code or in Explorer in general?

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2024-02-06T16:12:38+00:00

    i tried all available solution but problem still presist

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2024-01-21T00:24:23+00:00

    Currently can't open file because of this limitation on WIN 11, VS 22 preview.

    I have reg key set to 1 and policy enabled..

    Any ideas?

    Was this answer helpful?

    0 comments No comments
  4. Les Ferch 10,361 Reputation points Volunteer Moderator
    2024-01-04T14:30:37+00:00

    I've used this simple but excellent script to create filenames in excess of 400 characters. With the Group Policy Editor Long File Set on this all works fine for Win11 Pro.

    What script are you referring to?

    Edit: There was no reply to my question above, but it's likely just a batch file or PowerShell script that uses the *\?* prefix to create a long path and what works in Explorer is what always works. That is, you can navigate a long path in Explorer and edit files within that long path. Extending the length of the path cannot be done directly in Explorer.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2024-01-04T14:00:50+00:00

    and File Explorer could navigate, add, delete, etc past the 300 character mark.

    File Explorer in Windows 10 and Windows 11 has always been able to navigate a long path, regardless of the LongPathsEnabled setting. But, AFAIK, it has never been able to edit a long path.

    Just to confirm, I ran a test on 23H2 Build 22631.2361.

    With LongPathsEnabled set to 0 I get an error (as expected) when trying to CD to a path that exceeds 260 characters:

    Image

    With LongPathsEnabled set to 1 I am able to CD to the bottom of the long path (it's greater than 600 characters). This proves that my LongPathsEnabled setting is valid and effective for applications, such as Cmd, that support it.

    Image

    Now let's try File Explorer...

    I can navigate a long path:

    Image

    But if I try to create a folder at the end of that long path, I will always get this error:

    Image

    But you stated that Explorer, on your computer, can be used to add or delete a long path. Can you please check that again by trying the same test I did? That is, try to create a folder at the bottom of the long path folder tree.

    Thanks.

    I've used this simple but excellent script to create filenames in excess of 400 characters. With the Group Policy Editor Long File Set on this all works fine for Win11 Pro.

    In this deep folder I can create and edit text files and Microsoft Word files OK. But Microsoft Excel won't play ball. It will neither create or edit XLSX files. So this started out as a Win11 issue but ends up as a Microsoft Excel issue, but only in part. Microsoft Word, Powerpoint are fine, as is creating and editing a text document. But Excel will not work.

    If I create even deeper files beyond the 512 char limit then the Microsoft Office apps fail but Windows Explorer and text editing still does work.

    Paul

    Was this answer helpful?

    0 comments No comments