我想在映射网络驱动器之前检查网络驱动器是否有映射。 我使用此代码映射驱动器。
Dim network = New IWshNetwork_Class()
network.MapNetworkDrive("Z:", ServerDc, Type.Missing, username, pwd)
答案 0 :(得分:2)
IWshNetwork_Class
似乎是Windows脚本宿主对象模型COM库中的一个类。
Dim Network As IWshRuntimeLibrary.IWshNetwork_Class
Dim Drives As IWshRuntimeLibrary.IWshCollection_Class
Drives = Network.EnumNetworkDrives
For DriveCounter As Long = 0 To Drives.Count – 1 Step 2
MsgBox(Drives.Item(DriveCounter) & " is mapped to " & Drives.Item(DriveCounter + 1))
Next
请查看this PDF以获取更多信息......