如何实现此功能:
GetHost("C:\MyFolder"); //Local
GetHost("D:\MyFolder"); //Local
GetHost("\\FileServer1\MyFolder"); //FileServer1
GetHost("Y:\MyFolder"); //FileServer1
GetHost("\\LocalSharedFolder\MyOtherFolder"); //Local
GetHost("\\SpecialSharedFolder\YetAnotherFolder"); //FileServer2
EDIT1:
到目前为止,我已经尝试过DirectoryInfo,DriveInfo,ManagementClass
答案 0 :(得分:0)
GetDriveType可以告诉我磁盘是否是本地磁盘。 WNetGetConnection可以为我指出网络路径,在\\LocaSharedFolder
的情况下,我可以提取其主机名...