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-04-06T15:41:04+00:00

    Highlight all the text below that is in a different font (use right click mouse on the blank line below, move mouse down until all that text is highlighted)

    :fred
    
    md o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs100bytes
    
    cd o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs100bytes
    
    md o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs200bytes
    
    cd o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs200bytes
    
    md o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs300bytes
    
    cd o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs300bytes
    
    md o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs400bytes
    
    cd o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs400bytes
    

    press CTRL+C to copy to clip board. (highlight will dissappear)

    press [windows key+R], type notepad, press Enter key, this will launch notepad

    press CTRL+V, this will paste the text into notepad window.

    Now attempt to save the notepad file to a folder of your choice. I strongly suggest you figure out

    how to save to the desktop folder. Use the default name it suggests: fred

    press [windows key+R], type CMD, press Enter key, this will launch a console window

    type the text below and hit Enter:

    cd Desktop

    type the text below and hit Enter:

    move fred.txt fred.bat

    type the text below and hit enter:

    fred.bat

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. 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
  3. Anonymous
    2023-02-13T08:54:48+00:00

    Same probleme here, multiple clients can't add or change files. With bat script it will work but in Windows explorer only errors. MS need te update this.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  4. Anonymous
    2023-01-25T18:41:34+00:00

    It doesn't seem to work for any version of Windows 11, be it Pro, Education or Home

    I certainly have long paths working in 22H2 Windows 11 (22621.1105) today. All of these versions work: Home, Pro and Enterprise.

    For the Home version: Windows 11 Home does not come with GPEdit.MSC. But, I tried the registry key and without even rebooting the long paths started working in a new cmd console window that I opened after making that registry change.

    To test long paths I made a long.BAT with contents:

    md o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs100bytes

    cd o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs100bytes

    md o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs200bytes

    cd o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs200bytes

    md o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs300bytes

    cd o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs300bytes

    md o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs400bytes

    cd o123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789o1234_ThisIs400bytes

    I then ran the long.bat in my user folder. This correctly made a 400+ path

    I don't have easy access to the education version. You could try hitting the windows key + "R" to try running gpedit.msc to enable long paths. If that doesn't work then I assume the above trick that works for Windows 11 Home edition might work.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  5. Anonymous
    2023-01-14T08:39:59+00:00

    I'm amazed this is broken, even on Windows 11 pro 22H2

    It worked fine on my last Windows 10 pro machine

    Setting with regedit: BROKEN

    Setting with group policy: BROKEN

    Setting with M365 configuration: BROKEN

    It should be on by default!

    And it should work...

    Recently it's been broken on W10 as well though.

    Not quite the same as W11, since apps can apparently still write the files (unlike W11, where my C# app just died when it tried to write that file).

    But WinExplorer on my W10 (Home) laptop ... naaaah ... not happening anymore. Only have RegEdit for that one, no GPEdit.

    There it's broken in an annoying way too. The file is there, I can literally see it ... but if you try to rename, it won't work ... it won't let you type any characters anymore to 'add' and the 'save' just doesn't go through even if you've removed characters.
    Work around there is to then move the file to the root of some HDD path, rename it there & move it back.

    Anyway, max 260 characters is truly 80's level shizzle dudes, so it's a pain that such a basic feature doesn't work.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments