Share via

Lesser-known effect of path-length limitation in File Explorer in Windows 10

Anonymous
2020-08-11T06:38:09+00:00

Occasionally users encounter an error when dealing with files saved in deep directory structures, due to a limit on the maximum length of a path (including filename) in File Explorer, which is effectively 259 characters (excluding a required null terminator).  I have seen the effects of this before when using either SyncToy or xcopy (I forget now which;  maybe both).  

It turns out that there are a couple of behaviours in Windows Explorer, under Windows 10 (with default settings;  i.e. without a registry edit to remove the limit). 

(1)

Normally it is possible to copy the path (including filename) of a file from Windows Explorer by either choosing "Copy as path" from the context menu or through Home > Copy path. 

It turns out that if the length exceeds 260 characters (259 regular characters plus the obligatory <NUL> character), then Windows Explorer automatically copies the path in "short filename" format (a.k.a. "8.3 format" / "short name format").

Thus the path of

c:\long\path_name....\no_really\very_long_path_name\the.long_file_name_01234567890123456789_foo.txt

might get copied to the clipboard as

c:\long\path_n~1....\no_rea~2\very_l~1\thelon~4.txt

["...." just represents more of the path.]

(2)

Note that I can successfully copy files with longish names to folders with longish names to create paths that exceed the 260-character limit within File Explorer (even with the default settings)*.  I can then open, copy and delete those files. 

However, if I try to make a copy of the file in the same directory by dragging and dropping with the mouse, while Ctrl is depressed — so that File Explorer would want to append the suffix " - Copy" to the end (before the extension) — then the name gets truncated.  Not to the 8.3 format, but enough to easily satisfy the path limit. 

What do I mean by "easily satisfy"?  What I found is that the new filename will be precisely 10 characters shorter than the maximum allowed (taking into account the entire path).

Thus

c:\long\path_name....\no_really\very_long_path_name\the.long_file_name_01234567890123456789_foo.txt

might get duplicated as

c:\long\path_name....\no_really\very_long_path_name\the.long_fil - Copy.txt

and manually editing this filename would allow it to be expanded as far as (e.g.)

c:\long\path_name....\no_really\very_long_path_name\the.long_fil - Copy0123456789.txt

c:\long\path_name....\no_really\very_long_path_name\0123456789the.long_fil - Copy.txt

I didn't find either of these behaviours documented anywhere else. 

—DIV

System information:

OS Name    Microsoft Windows 10 Pro for Workstations

Version    10.0.16299 Build 16299

System Type    x64-based PC

* This functionality would implicitly be using an extended-length path, with a limitation of 32767 characters in total (with each constituent director or file's name being no more than ~255 characters).

Windows for home | Windows 10 | 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

1 answer

Sort by: Most helpful
  1. Anonymous
    2020-08-13T05:52:20+00:00

    Opening multiple XML files in different tabs of a single instance of "Office XML Handler" (a.k.a. Internet Explorer)

    When working with XML files with moderate pathname lengths, I am able to open multiple XML files in different tabs of a single instance of "Office XML Handler" (a.k.a. Internet Explorer) by simply double-clicking them, or pressing <Enter> with the relevant XML file(s) selected, or by choosing 'Open with' in the context menu, in File Explorer

    This is possible both when Internet Explorer is not open (in which case a fresh instance is automatically created), and when Internet Explorer is already open with one or more tabs with arbitrary content (XML files or internet content, for example). 

    However, I can not do this for XML file with long pathnames, i.e. with lengths exceeding 259/260 characters. 

    For such files there is no way at all for me to open multiple XML files in "Office XML Handler" / Internet Explorer

    I can open one single such XML file at a time, and only ever in a fresh instance of the viewing application. 

    Once this file is open, I cannot open any such additional XML files in other tabs, nor in the existing tab.  Even if the existing tab(s) are just regular internet content, I cannot open any such additional XML files in other tabs, nor in the existing tab(s). 

    When Internet Explorer is not open I can open a single such XML file (in which case a fresh instance of Internet Explorer is automatically created).  Within this instance I can add more tabs and load internet content, or open XML files with moderate pathname lengths, but not XML files with excessively long pathname lengths. 

    When Internet Explorer is already open with one or more tabs with arbitrary content (XML files or internet content, for example), there is no possible way for me to open an XML file with an excessively long pathname length — except by closing the existing instance, thereby enabling the previously described route. 

    Opening multiple HTML files in different tabs of a single instance of Internet Explorer

    Identical behaviour occurs with HTML files with long path names. 

    Software details:

    Internet Explorer 11:  version 11.1087.16299.0

    OS:  Windows 10 (with default settings;  i.e. without a registry edit to remove the limit on pathname length).

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments