我想在映射网络驱动器之前检查网络驱动器是否有映射。我使用此代码来映射驱动器。
Dim network = New IWshNetwork_Class()
network.MapNetworkDrive("Z:", ServerDc, Type.Missing, username, pwd)
我想在映射网络驱动器之前检查网络驱动器是否有映射。我使用此代码来映射驱动器。
Dim network = New IWshNetwork_Class()
network.MapNetworkDrive("Z:", ServerDc, Type.Missing, username, pwd)
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
请查看此 PDF以获取更多信息...