{"id":111262,"date":"2025-06-11T07:00:00","date_gmt":"2025-06-11T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=111262"},"modified":"2025-06-11T10:11:35","modified_gmt":"2025-06-11T17:11:35","slug":"20250611-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20250611-00\/?p=111262","title":{"rendered":"Removing the <CODE>MAX_PATH<\/CODE> restriction on paths applies only to paths"},"content":{"rendered":"<p>A customer was playing around with Windows long paths and found that even though they used the <tt>\\\\?\\<\/tt> long path prefix, they still couldn&#8217;t use a long path.<\/p>\n<p>The documentation on the <a title=\"Maximum Path Length Limitation\" href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/fileio\/maximum-file-path-limitation\"> maximum path limitations<\/a> say that the <tt>\\\\?\\<\/tt> prefix is always available. Just to make sure, they set the registry key and created the corresponding manifest entry to enable long paths without the <tt>\\\\?\\<\/tt> prefix, but that didn&#8217;t help.<\/p>\n<p>They wanted to know what they were doing wrong and included a short program to demonstrate.<\/p>\n<p>The path in their sample program was <tt>C:\\looooooooo\u27e6 1000 more o's \u27e7ooong.txt<\/tt>. This is well under the 32,767 limit,\u00b9 so why doesn&#8217;t it work?<\/p>\n<p>Although the <tt>\\\\?\\<\/tt> prefix and the long path setting raise the path limit to 32,767 characters, the length of each individual component of the path is also subject to a length limit. You can query this limit by calling <code>Get\u00adVolume\u00adInformation<\/code> and checking the maximum component length. Values you might see include 255 (exFAT, NTFS), 110 (Joliet CD-RW in Unicode mode), and for network volumes, it&#8217;s determined by the network protocol.<\/p>\n<p>In the customer&#8217;s case, they were passing a file name that was over 1000 characters long, which probably exceeded the maximum component length.<\/p>\n<p>They can try again by using a path with longer individual components, where each one is only 100 (say) characters long, but which collectively add up in length to something greater than <code>MAX_PATH<\/code> (260).<\/p>\n<p>\u00b9 Note that the 32,767 limit includes any expansion that occurs during internal processing, so the practical limit for applications is a bit less than that.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The individual file names still retain their existing limits.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-111262","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>The individual file names still retain their existing limits.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/111262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=111262"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/111262\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=111262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=111262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=111262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}