如何检查地图网络驱动器连接? [英] How to check map network drive connection?

查看:33
本文介绍了如何检查地图网络驱动器连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在映射网络驱动器之前检查网络驱动器是否有映射.我使用此代码映射驱动器.

 Dim network = New IWshNetwork_Class()network.MapNetworkDrive("Z:", ServerDc, Type.Missing, username, pwd)

解决方案

IWshNetwork_Class 似乎是 Windows 脚本宿主对象模型 COM 库中的一个类.

将网络调暗为 IWshRuntimeLibrary.IWshNetwork_Class将驱动器调暗为 IWshRuntimeLibrary.IWshCollection_Class驱动器 = Network.EnumNetworkDrives对于 DriveCounter As Long = 0 To Drives.Count – 1 第 2 步MsgBox(Drives.Item(DriveCounter) & " 映射到 " & Drives.Item(DriveCounter + 1))下一个

查看此 PDF 了解更多信息...>

I want to check whether the network drive had map before I map the network drive. I use this code to map the drive.

 Dim network = New IWshNetwork_Class()

                network.MapNetworkDrive("Z:", ServerDc, Type.Missing, username, pwd)

解决方案

IWshNetwork_Class appears to be a class in the Windows Script Host Object Model COM library.

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

Have a look at this PDF for more information...

这篇关于如何检查地图网络驱动器连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆