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-07T13:21:02+00:00

    If you can navigate and edit long paths at a Cmd prompt, without having to use the *\?* prefix, then that means the LongPathsEnabled setting is working correctly.

    However, Explorer (even the latest version in 23H2) does NOT support long paths, regardless of the LongPathsEnabled setting. You can navigate long paths with Explorer, but you cannot make any change that will extend the path.

    For long path support, in a GUI file manager, you'll have to turn to third party solutions, such as XYPlorer.

    Long path support in Explorer is long overdue.

    Please upvote this feedback if you have a regular Windows account:

    https://aka.ms/AAn2h9t

    Please upvote this feedback if you have an Insider account: https://aka.ms/AAn2b02

    Was this answer helpful?

    9 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2023-02-15T17:59:05+00:00

    After a few months of this, and opening a Microsoft trouble ticket, I found the issue and the solution:

    The registry change is not the way to enable long paths with windows 11. Use the GPEDIT technique you described:

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

    The above also sets that registry key too, so you only need to do the Group policy change. This gives you as much long path support that Win10 had/has. With one exception: ISE PowerShell. Even though Win11 has a long path enabled manifest for the ISE PowerShell EXE, it does not appear to honor it. No idea why it doesn't work, but ISE is now being phased out, so probably not a good plan to use that console any more.

    Win10 and Win11 do have their limitations regarding long path names:

    1. filenames are limited to 256 bytes (and yes, some unicode chars count as multiple bytes
    2. folder names are limited to 256 bytes.
    3. If you do the math, and you want a 32K long path, that's at least 128 deep folder structure. I've made a few of these on my win11 box and it's not pretty. You'll run into all sorts of issues with explorer and the command console. These issues are common to both Win10 and Win11, so Windows 11 is just as good at long paths as Windows 10. (except the ISE console)

    I ported my application to use long paths and it works great on Win10 and Win11. I had to switch command line parameters to response files because the command line is also limited to 32K bytes. (i.e. can't pass a long filename AND parameters, 2 long filenames are right out!). The Win32 APIs that support 32K path names are very limited and do require you use UNC and unicode versions of the names.

    Microsoft have a long way to go with regard to proper support of long filenames. I'd like to see the 256 byte limitations above removed, and command line length increased by at 10X or more. Obviously explorer.exe needs to support long names (but, attempting to display a 32K filename on a single screen is rather challenging - and virtually impossible to use within the debugger (since strings are typically only allowed a single line).

    In summary, until Microsoft allows long path names in their inbox apps and implements full support for it, this issue should not be considered resolved or fixed. Even if they could just get Explorer.exe to work with very long file paths, that would be an ENORMOUS help to millions of users and for users that like to keep things very organized with folder and useful file names.

    Please, Microsoft, at least make explorer. exe long path aware and allow us to make very long path names from within the explorer.exe app using it's rename function.

    Was this answer helpful?

    9 people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2023-04-12T15:06:42+00:00

    setting the DWORD registry key is a trap. It'll put your machine into a bad state if you're running win11.

    The correct way to enable long path support on windows 11 is to only use the GPEDIT technique.

    I suggest resetting both back to default. reboot. Then try the GPEDIT technique.

    The GPEDIT method will change the DWORD in the registry to a non-zero value. I suspect there's other housekeeping GPEDIT does for the modification and I guess it skips it if the DWORD is already set.

    But this doesn't solve the issue for people with Win 11 Home edition.

    This ticket should not be closed.

    Was this answer helpful?

    7 people found this answer helpful.
    0 comments No comments
  4. 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
  5. Anonymous
    2023-01-16T17:22:42+00:00

    Ok. Final update from my trouble ticket with Microsoft:

    "Hope you are doing well,

    We have checked the same on our Windows 11 environment and unfortunately due to product limitations the long path enabled does work on the scenario

    that you have been facing.

    You can post the same on feedback hub, so that next time when a patch will be released, this feature may get an update.

    You can find the feedback hub, by clicking on the start menu and type feedback hub and select the category accordingly."

    So, the first couple of times I read that, I thought it said that they reproduced the issue. But, reading it again I think it says the opposite.

    Good luck finding a feedback hub issue on long paths that has a lot of up votes. LOL, they're probably using bing as their search engine🤦‍♀️

    Was this answer helpful?

    6 people found this answer helpful.
    0 comments No comments