非常感谢,将客户端IP写入/etc/hosts后可以调用成功了,但是需要输入用户密码,而rexec命令又没有指定密码的参数,请问能否不需要手工输入密码?另外wsock32.dll中提供了函数rexec,在VB中调用代码如下:
Private Declare Function rexec Lib "wsock32.dll" (User As String, Passwd As String, HostName As String, Cmd As String, Path As String, mode As Long) As Long
Private Sub Command1_Click()
Dim ret As Long
Dim User As String
Dim Passwd As String
Dim HostName As String
Dim Cmd As String
Dim Path As String
Dim mode As Long
User = "name"
Passwd = "passwd"
HostName = "host"
Cmd = "pwd"
Path = "c:\\result.txt"
mode = 0
ret = rexec(User, Passwd, HostName, Cmd, Path, mode)
End Sub
执行的返回值总是-1,不知何故,望指教。