File Name Too Long? Fix Windows Path Limits
If you see a “file name too long� error on Windows, the cause is almost always the MAX_PATH limit: the full path to the file exceeds 260 characters. The fix is to shorten the path, enable long paths in Windows settings, or use a tool that bypasses the limit.
Why Windows Has a 260-Character Limit
Windows inherited the 260-character path limit from the MS-DOS era. The constant MAX_PATH in the Windows API defines the maximum length of a full path (drive letter, folders, file name, and null terminator). This limit applies to the entire path, not just the file name. For example, C:\Users\John\Documents\Projects\2024\Reports\Q3\Final\draft-v2-final.docx is 79 characters—well within the limit, but a deeply nested folder structure can easily push a short file name over 260.
Modern Windows 10 and 11 can handle longer paths, but the feature is off by default for compatibility. When it’s off, applications that use the older API functions (like many Explorer operations and older programs) still hit the limit.
How to Check the Full Path Length
Before fixing, confirm that the path is the problem. Right-click the file or folder, select Properties, and look at the Location field. Add the file name to that location and count the characters. If it’s over 260, that’s your issue.
Alternatively, use PowerShell to get the exact length:
- Open PowerShell (Start > type “PowerShell�).
- Run:
(Get-Item "C:\path\to\your\file.txt").FullName.Length - The number returned is the character count. If it’s over 260, you need to shorten it.
Quick Fix: Shorten the Path
The simplest solution is to reduce the path length. You can:
- Rename folders to shorter names (e.g., “Documents and Settings� → “Docs�).
- Move the file to a higher-level folder, like directly under
C:\. - Shorten the file name itself, but remember the limit applies to the whole path.
If you have many files in a deep structure, consider restructuring your folder hierarchy. For example, instead of C:\Users\Name\Documents\Work\2024\Projects\Client\Deliverables\Final\, use C:\Work\Client\Final\.
Enable Long Paths in Windows (Windows 10/11)
Windows can support paths up to 32,767 characters if you enable the long path feature. Here’s how:
- Press Win + R, type
gpedit.msc(Pro/Enterprise) orregedit(all versions). - For Group Policy: Navigate to Computer Configuration > Administrative Templates > System > Filesystem.
- Double-click Enable Win32 long paths, set it to Enabled, and restart.
- For Registry (if no gpedit): Go to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem, create a DWORD namedLongPathsEnabled, set value to1, and restart.
Note: This enables long paths for applications that are “long path aware.� Many modern apps (like Visual Studio, 7-Zip) support it, but some older ones still won’t. Explorer itself generally works with long paths after this change, but you may still encounter issues with certain operations.
Use Tools That Bypass the Limit
If you can’t change the system setting or need to work with existing long paths, use a file manager that handles long paths natively. Popular options include:
- 7-Zip – File manager can browse and copy files with long paths.
- Total Commander – Has a “long paths� option.
- PowerShell – Many cmdlets support long paths if you use the
\?\.prefix.
For example, in PowerShell you can copy a file with a long path using:
Copy-Item -Path "\\?\C:\very\long\path\file.txt" -Destination "C:\short\file.txt"
The \\?\ prefix tells Windows to use the extended-length path syntax, which bypasses the 260-character limit.
Common Mistakes and Misconceptions
One common mistake is thinking the limit is only on the file name. It’s the full path. A file named “a.txt� can still fail if the folder path is 300 characters.
Another misconception: renaming the file to a shorter name always fixes it. It only helps if the file name is the bulk of the path. Often the deep folder structure is the problem.
Also, some users try to delete a file with a long path and get “Source path too long.� That’s the same limit. You can’t delete it from Explorer, but you can use rmdir with the \\?\ prefix in Command Prompt.
When the Limit Still Applies
Even with long paths enabled, some situations remain problematic:
- Applications not updated – Older software that uses the ANSI version of API calls will still fail.
- Windows Store apps – Some UWP apps have their own restrictions.
- Network shares – The server may have its own path length limits.
If you’re working with files on a network drive, the limit might be on the server side. Check with your network administrator.
Preventing Future Issues
To avoid hitting the limit again, adopt these habits:
- Keep folder names short and avoid unnecessary nesting.
- Use a flat structure for project files (e.g.,
C:\Projects\Client\Year\). - Periodically check for paths over 200 characters using a script.
If you’re a developer, consider using version control systems that don’t rely on long paths, or use symbolic links to shorten paths.
Frequently Asked Questions
Why does Windows still say “file name too long� even after I enabled long paths?
Enabling long paths only affects applications that are compiled to support it. Many older or simpler programs (including some built-in tools) still use the old API and will continue to fail. You may need to use a different tool or shorten the path.
Can I delete a file with a path longer than 260 characters?
Yes. Use Command Prompt or PowerShell with the \\?\ prefix. For example: del "\\?\C:\full\path\file.txt". For folders, use rmdir /s "\\?\C:\full\path\folder".
Does the limit apply to external drives or USB sticks?
Yes, the limit is on the Windows file system (NTFS, FAT32) and applies to any drive, including external ones. FAT32 has a 255-character limit per file name, but the full path limit is still 260.
What is the actual maximum path length in Windows 10/11?
With long paths enabled, the maximum is 32,767 characters, but each component (folder or file name) cannot exceed 255 characters. This is the NTFS limit.
Can I rename a file with a long path without using a tool?
You can try using the ren command in Command Prompt with the \\?\ prefix. For example: ren "\\?\C:\long\path\file.txt" newname.txt. If that fails, use a file manager that supports long paths.
Is there a way to make all apps support long paths?
No, each application must be written to use the long path APIs. Microsoft has provided guidance, but it’s up to developers to update their software. For now, you’ll need to work around it.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.