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. Anonymous
    2023-02-15T17:49:23+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).

    Was this answer helpful?

    3 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-02-23T10:05:16+00:00

    It is Feb 2023, and I am still facing this issue. I don't know why they are not providing any solution to this.

    Was this answer helpful?

    6 people found this answer helpful.
    0 comments No comments
  4. Anonymous
    2023-02-23T16:34:11+00:00

    It is Feb 2023, and I am still facing this issue. I don't know why they are not providing any solution to this.

    Microsoft closed their ticket on this. The long 32K paths work for me on win11 except for ISE PowerShell. What issue are you seeing?

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  5. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more