在 VBScript 中映射网络驱动器并检查其是否存在
我需要使用 VBScript 将网络驱动器映射到网络路径。网络路径直接从输入读取。如何映射网络驱动器以及如何检查输入的网络路径是否已存在?
I need to map a network drive into a network path using VBScript. The network path is read directly from input. How should I map the network drive and how to check whether the entered network path already exists?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我创建了一个子例程来映射驱动器...
我将其留给您处理错误检查等。或者,如果您更喜欢网络使用路线,您可以执行类似的操作..
您可以更进一步,自动使用下一个可用的使用示例 脚本专家创建。
我希望这有帮助。
I created a subroutine to map drives...
I leave it up to you do handle error checking etc. Alternatively if you prefer the net use route you could do something like..
You can take it a step further to automagically use the next available drive letter to map drives using an example The Scripting Guys created.
I hope this is helpful.
在 vbscript 文件中运行以下命令:
例如:
示例命令会将 \Hadi\temp 映射到 Z:
另请参阅 此 VBScript 文件用于映射网络驱动器。
run the following command in you vbscript file:
for example:
The sample command will map \Hadi\temp to Z:
Also take a look at this VBScript file for mapping network drives.
我本人并不是 WMI 的忠实粉丝(它有点臃肿且缓慢),因此我使用以下代码将网络共享映射到第一个可用的驱动器号,并检查它是否已成功安装:
I am not a big fan o WMI by myself (it's a little bloat and slow), so I used the following code to map a network share to the first available drive letter and checks if it was mounted successfully: