How to rename or relabel a Network Drive label

前端 未结 3 490
-上瘾入骨i
-上瘾入骨i 2020-12-20 07:20

I am mounting a network drive to windows using WNetAddConnection2 which is working fine but while mounting the drive by default it assigns the name as Server IP and FolderNa

3条回答
  •  鱼传尺愫
    2020-12-20 08:04

    I tried using vb script for renaming thr drive:

    LPCTSTR szCode = "Function RenameDrive(strNewName,strDriveLetter) \r\n\
                         Dim objShell \r\n\
                         Set objShell = CreateObject(\"Shell.Application\") \r\n\
                         'if objShell is Not Nothing Then \r\n\
                         objShell.NameSpace(strDriveLetter).Self.Name = strNewName \r\n\
                         'End if \r\n\
                         End Function";
    

提交回复
热议问题