注册 登录
自由的生活_软路由 返回首页

moou的个人空间 https://bbs.routerclub.com/?5058 [收藏] [复制] [分享] [RSS]

日志

映射磁盘的vbs

已有 1406 次阅读2013-4-22 14:53 | 海外


strRemotePath = "\\192.168.2.252\海外部公共目录$" 
strNewName = "海外部公共目录"
strUser =inputbox("请输入用户名")
strPassWord=inputbox("请输入密码")
strDriveLetter="S:"

Set objNetwork = CreateObject("Wscript.Network")
Set colDrives = objNetwork.EnumNetworkDrives
      
For i = 0 to colDrives.Count-1 Step 2         
        TmpstrDriveLetter = colDrives.Item(i) 
 'Wscript.echo TmpstrDriveLetter 
 if TmpstrDriveLetter = strDriveLetter then objNetwork.RemoveNetworkDrive TmpstrDriveLetter,True  
Next

' Section to map the network drive
Set objNetwork = CreateObject("WScript.Network") 
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath,,strUser, strPassWord

' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter).Self.Name = strNewName


路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-12-22 15:51 , Processed in 0.033215 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

返回顶部