How can i manage to get the IP or path like \11.1.1.100\projects of a connected network share with a drive letter. I only have the drive letter and want to get the IP of the Share with python. Many Thanks... Sashmo开发者_如何学Python
I don't know the python equivalent, but WNetGetConnection will give you the UNC path mapped to the drive letter:
wchar_t szName[256];
DWORD chName = 256;
DWORD dwResult = WNetGetConnectionW(L"Z:", szName, &chName);
I'm sure there is a python module that wraps this functionality. From the UNC path you can get the server name, and from that you can lookup its IP address.
精彩评论