自动映射盘脚本

On error resume next
strRemotePath = "\\server01\share"
strNewName = "share"
Set objNetwork = CreateObject("Wscript.Network")
Set colDrives = objNetwork.EnumNetworkDrives
For i = 0 to colDrives.Count-1 Step 2
        strDriveLetter = Chr(Asc(Left(colDrives.Item(i),1))-1) & ":"
Next
If strDriveLetter= "" Then strDriveLetter="s:"
' Section to map the network drive
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter).Self.Name = strNewN

你可能感兴趣的:(职场,脚本,休闲,映射盘)