• 映射网络驱动器VBS脚本


    On error resume next
    strRemotePath 
    = "\\UNC路径" 
    strNewName 
    = "要显示的名称"

    Set objNetwork = CreateObject("Wscript.Network")
    Set colDrives = objNetwork.EnumNetworkDrives
          
    For i = 0 to colDrives.Count-1 Step 2
            
            
    Set objShell = CreateObject("Shell.Application")
            strDriveLetter 
    = colDrives.Item(i)
            strName 
    = objShell.NameSpace(strDriveLetter).Self.Name
            strName 
    = Left(strName,Len(strName)-5)
            
    If strName = strNewName Then WScript.Quit
            
            strDriveLetter 
    = Chr(Asc(Left(colDrives.Item(i),1))-1& ":"
                   
    Next

    If strDriveLetter= "" Then strDriveLetter="Z:"

    ' 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 
    = strNewName
  • 相关阅读:
    MinGW GCC 7.1.0 2017年6月份出炉啦
    java面试题-框架篇九
    spring-AOP原理
    spring的bean管理(注解)
    23种设计模式(1)-单例模式
    SSH框架面试题集锦
    JQuery基础
    实现用户注册
    spring与hibernate的整合
    spring-IOC理解1
  • 原文地址:https://www.cnblogs.com/top5/p/1587548.html
Copyright © 2020-2023  润新知