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-25T16:05:39+00:00

    While true, that's entirely irrelevant. No normal person is using Windows via the command line.

    Even me, who knows my way around a cmd prompt would never want to have my daily/hourly/minutesly interactions go via the command line.

    It's fine if you have a **** ton of files to copy over from path A to B and it contains deep nesting, etc.

    That'll generally be a one-time thing, so fine to whip out the command line for that (with the added benefit that robocopy is much faster at doing this than WinExplorer).

    It's entirely another thing if you're just going about your daily business of managing/organizing your files.

    How often I don't hit this limit while simply organizing my files, it's just stupid and annoying in this day 'n age.

    Worst of it is that, while Explorer shows the file that exceeds the character limit, it then doesn't allow you to rename said file (without even an error, just doesn't save the edit).

    So overall, for many people WinExplorer == Windows. Having that one support long paths is the very least you could expect from them.

    For such simple rename operations, to get files within the limits I've found that opening the folder in WinRAR allows me to properly rename the files in that folder that way. Though there's no way I'm gonna start using WinRAR as WinExplorer.

    You'd pretty much have to replace WinExplorer by a 3rd party app to be able to fully do basic file management these days.

    At this point it's obvious they don't care to fix it though.

    Was this answer helpful?

    3 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2022-12-22T16:27:29+00:00

    each folder can only be up to about 256ish bytes. Same limit for the filename part.

    Try this script to test your windows 10 box:

    md ./o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs100bytes

    cd ./o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs100bytes

    md ./o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs200bytes

    cd ./o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs200bytes

    md ./o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs300bytes

    cd ./o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs300bytes

    md ./o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs400bytes

    cd ./o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs400bytes

    Windows 11 fails to make the 300byte folder

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2022-12-22T14:07:47+00:00

    I can't get long paths to work even in my current version (installed December 14, 2022) of Windows 10 Professional. Any suggestions most appreciated.

    System info:

    Edition Windows 10 Pro

    Version 22H2

    Installed on ‎14-‎Dec-‎2022

    OS build 19045.2364

    Experience Windows Feature Experience Pack 120.2212.4190.0

    I have made the following changes and then rebooted:

    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.

    I still cannot, as a test, save a text file (i.e. with extension .txt) on C:/ with the following name (which has over 260 characters, since 10 repeats of the 26 character English alphabet plus separating dashes):

    abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz.txt

    Was this answer helpful?

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

    I've heard nothing from them since 9th Dec

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments
  5. 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