What is a minimal valid UNC path?

倾然丶 夕夏残阳落幕 提交于 2019-12-11 13:02:40

问题


I want to make a library that (among other things) parses UNC paths, but I don't fully understand the grammar.

Common example is: \\server\share\path

Are all of those required for a valid file path? I can navigate to \\server (without share) using Windows Explorer, but I assume it is using some share discovery protocol, not something filesystem APIs understand — is this right?


回答1:


You are correct. A UNC path is required to have share name component.

Quoting MSDN:

UNC = \\<hostname>\<sharename>[\<objectname>]*

The <hostname>, <sharename>, and <objectname> are referred to as "pathname components" or "path components". A valid UNC path consists of two or more path components.

https://msdn.microsoft.com/en-us/library/gg465305.aspx



来源:https://stackoverflow.com/questions/28167080/what-is-a-minimal-valid-unc-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!