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