A while ago, one of my apps refused to open a file that was stored deep inside multiple folders, giving me an error that said, “File cannot be opened…” I initially thought another application was using the folder/file, but that wasn’t the case.
The file eventually opened when I moved it outside the folder. I could’ve dropped the case there and moved on with my life, but I’m a man of curiosity and wanted to find out why I got the error in the first place. I did a bit of research and went through a couple of forums, and discovered that Windows has a long-standing restriction called MAX_PATH, which limits the length of a file path to 260 characters.
Windows’ 260-character path limit
A decades-old compatibility rule can still get in the way of opening files
Windows has historically enforced a MAX_PATH restriction of 260 characters for many file operations. A path such as C:FolderSubfolder… includes every folder name along the way, plus the file name and extension. When a file is deep inside nested directories, that full path can easily exceed the limit, causing some applications to fail to open, save, or locate it.
The strange part is that the limitation isn’t really imposed by the NTFS file system itself. NTFS supports much longer paths (up to 32,767 characters), but many Windows applications still rely on the older Win32 API that uses the MAX_PATH limit.
For decades, Windows developers wrote applications that assumed a file path would never exceed 260 characters. Some used fixed-size buffers based on the MAX_PATH constant. If Windows suddenly passed a much longer path to one of those applications, it could cause a buffer overflow, corrupt memory, crash the app, or potentially introduce a security vulnerability.
Microsoft couldn’t simply remove the limit for every application without risking compatibility problems. That’s why the restriction stuck around, even as the underlying file system became capable of handling much longer paths.
Microsoft added a way to bypass the limit in Windows 10
The feature is available, but it’s disabled by default
Microsoft addressed the long-path problem with Windows 10 version 1607, introducing support for Win32 applications to work with paths longer than 260 characters. The fix is there, and it can help prevent the frustrating errors that happen when a file is too deep in a folder structure.
But Microsoft still leaves it in the hands of users to enable it. So, unless you turn on long-path support yourself, Windows and some applications can continue to run into the same old MAX_PATH limitation.
This isn’t a universal fix for every Windows app. An application needs to declare long-path support. If it still relies on older path-handling behavior, it may continue to run into the same problem even after you enable long-path support.
How to enable long-path support on Windows
Use Group Policy or the Registry to turn on the setting
I use Windows 11 Pro, so I’m able to access the Group Policy Editor. Windows 11 Enterprise and Education users can also access the Group Policy Editor. Here’s how to enable long-path support.
- Type “gpedit.msc” in the Windows search bar and press Enter
- Go to Computer Configuration -> Administrative Templates -> System -> Filesystem
- Then, double-click Enable Win32 long paths
- Select the Enabled option
- Click Apply, then OK
- Restart your PC to apply the change
Unfortunately, Windows 11 Home users don’t have access to Group Policy Editor. But the same setting can be changed through the Registry Editor. However, ensure you create a restore point before proceeding because any mistake could damage your system.
- Type “regedit” in Windows Search and press Enter
- Navigate to HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlFileSystem
- Find the LongPathsEnabled value. If it doesn’t exist, create a new DWORD (32-bit) Value with that name
- Double-click LongPathsEnabled and set its value data to 1
- Click OK and restart your PC
One small Windows tweak can save a lot of frustration
I’ve only run into this limit once, but that doesn’t make it any less of an unpleasant experience. I could have kept moving files out of deep folders whenever Windows refused to open them, but that would only have been a workaround.
Enabling long-path support addresses the underlying problem, provided the applications I use are compatible with it. It’s a small change that can save me from running into the same annoying error again, especially when working with nested folders or large collections of files. It’s also a reminder that some of Windows’ oldest limitations are still around, even when Microsoft has already provided a way to work around them.