{"id":33243,"date":"2005-11-22T10:00:15","date_gmt":"2005-11-22T10:00:15","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2005\/11\/22\/why-is-a-drive-letter-permitted-in-front-of-unc-paths-sometimes\/"},"modified":"2005-11-22T10:00:15","modified_gmt":"2005-11-22T10:00:15","slug":"why-is-a-drive-letter-permitted-in-front-of-unc-paths-sometimes","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20051122-15\/?p=33243","title":{"rendered":"Why is a drive letter permitted in front of UNC paths (sometimes)?"},"content":{"rendered":"<p><P>\nA little-known quirk is that the file system accepts and ignores\na drive letter in front of a UNC path.\nFor example, if you have a directory called\n<CODE>\\\\server\\share\\directory<\/CODE>, you can say\n<\/P>\n<PRE>\ndir P:\\\\server\\share\\directory\n<\/PRE>\nand the directory will be listed to the screen.\nThe leading <CODE>P:<\/CODE> is ignored.\n<\/P>\n<P>\nWhy is that?\n<\/P>\n<P>\nRewind to 1984 and the upcoming release of MS-DOS 3.1,\nwhich added networking support.\nUp to this point, all fully-qualified file specifications\nconsisted of three components:\nA drive letter, a path, and a file name.\nMany programs relied on this breakdown and did things like\n&#8220;helpfully&#8221; prepend a drive letter if it looks like you\n&#8220;forgot&#8221; one.\nFor example, if you told it to save the results to\n<CODE>\\\\server\\share\\file.txt<\/CODE> it would say,\n&#8220;Oh dear, that&#8217;s not good, the user forgot the drive letter!\nI&#8217;ll put the current drive in front to make things better,&#8221;\nresulting in\n<CODE>C:\\\\server\\share\\file.txt<\/CODE>.\nOther programs would prompt you with\n&#8220;Please enter a drive letter&#8221;,\nand you couldn&#8217;t say &#8220;No, there&#8217;s no drive letter, just\ntake the path and use it.&#8221;\nThey insisted on a drive letter,\nand you darn sure better give them one.\n<\/P>\n<P>\n(Compare the Unix programs that &#8220;helpfully&#8221; rewrite\n<CODE>\/\/server\/volume\/file<\/CODE> as\n<CODE>\/server\/volume\/file<\/CODE> because they &#8220;know&#8221;\nthat consecutive slashes collapse,\nunaware of the special exception for two leading slashes.)\n<\/P>\n<P>\nIn order to retain compatibility with programs that\nprovided this sort of &#8220;unwanted help&#8221;,\nthe designers of the networking support in MS-DOS\ndecided to allow the strange syntax <CODE>C:\\\\server\\share\\directory<\/CODE>\nand treat it as if the drive letter simply weren&#8217;t there.\nSome (but not all) of this quirk of path parsing persists today.\n<\/P> \n<P>\n[Raymond is currently away; this message was pre-recorded.]\n<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A little-known quirk is that the file system accepts and ignores a drive letter in front of a UNC path. For example, if you have a directory called \\\\server\\share\\directory, you can say dir P:\\\\server\\share\\directory and the directory will be listed to the screen. The leading P: is ignored. Why is that? Rewind to 1984 and [&hellip;]<\/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":[2],"class_list":["post-33243","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>A little-known quirk is that the file system accepts and ignores a drive letter in front of a UNC path. For example, if you have a directory called \\\\server\\share\\directory, you can say dir P:\\\\server\\share\\directory and the directory will be listed to the screen. The leading P: is ignored. Why is that? Rewind to 1984 and [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/33243","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=33243"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/33243\/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=33243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=33243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=33243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}