character path limitation

Glenn Maxwell 10,751 Reputation points
2024-06-25T06:17:24.82+00:00

Hi all, I have a file on a Windows server that I want to rename, but the file name exceeds 256 characters. I understand there is a 256-character path limitation. Is it possible to rename a file with a name longer than 256 characters

Windows Server 2019
Windows Server 2019
A Microsoft server operating system that supports enterprise-level management updated to data storage.
3,600 questions
Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,069 questions
Windows Server 2016
Windows Server 2016
A Microsoft server operating system that supports enterprise-level management updated to data storage.
2,429 questions
Windows Server 2012
Windows Server 2012
A Microsoft server operating system that supports enterprise-level management, data storage, applications, and communications.
1,567 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,595 questions
0 comments No comments
{count} votes

Accepted answer
  1. Hania Lian 11,031 Reputation points Microsoft Vendor
    2024-06-25T07:47:25.26+00:00

    Hello!

    Windows Server, starting with Windows Server 2016 and Windows 10 Version 1607, supports long pathnames by default, which means that the maximum length of a path is no longer the traditional 260 characters.

    To enable long paths, enable the "Enable Win32 Long Paths" option in Group Policy. You can access the Group Policy Editor by following these steps:

    1. Open the Run dialog box, type gpedit.msc and press Enter.
    2. Go to Computer Configuration > Administrative Templates > System > File System.
    3. Find the "Enable Win32 Long Path" option on the right pane, double-click it and set it to the "Enabled" state.
    4. Click the Apply and OK buttons, and then close the Group Policy Editor.

    When long paths are enabled, you can create, copy, move, and rename file paths longer than 260 characters on your Windows Server.

    https://learn.microsoft.com/zh-cn/windows/win32/fileio/maximum-file-path-limitation?tabs=registry

    Best Regards,

    Hania Lian

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Andreas Baumgarten 103.6K Reputation points MVP
    2024-06-25T06:28:41.6066667+00:00

    Hi @Glenn Maxwell ,

    maybe this trick in the video will help to rename a file with a "long" name:

    Rename/Delete files with long names | Windows Quick Fix Guide


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards

    Andreas Baumgarten

    0 comments No comments

  2. Gary Nebbett 5,846 Reputation points
    2024-06-25T10:20:41.0033333+00:00

    Hello Glenn,

    It is difficult to determine whether you are asking whether the file path can exceed a certain length or whether any individual component of the path can exceed 255 characters.

    The full path can be longer than 256 characters but individual components have a maximum length of 255 characters. The on-disk structures for NTFS use a byte to hold the length of a name.

    Gary

    0 comments No comments