Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Private Sub Command5_Click() Dim strPath As String strPath = "\\192.168.11.6\运营支持部备份文件夹" ShellExecute 0, "open", strPath, "", App.Path, 5 End Sub
先调用 net 命令或用API或用WMI对象等与其主机连接,再打开就完事了 如: call shell("cmd /c net use \\192.168.11.6 /user:adminisreator 123456",0)
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Command5_Click()
Dim strPath As String
strPath = "\\192.168.11.6\运营支持部备份文件夹"
ShellExecute 0, "open", strPath, "", App.Path, 5
End Sub
如:
call shell("cmd /c net use \\192.168.11.6 /user:adminisreator 123456",0)