Below is an example to make use of my function, Shell_SendKeysWithTimeout to send shell command to remote Unix server via telnet, and keep the command running even after disconnection(nohup).
Code:
Dim FailedReason As String
Dim oShell As Object
Set oShell = CreateObject("WScript.Shell")
Dim CmdTxt As String
CmdTxt = "telnet " & IP & vbCrLf & _
user & vbCrLf & _
pw & vbCrLf & _
"nohup sample_script " & vbCrLf & _
""
oShell.Run ("cmd.exe")
Sleep 1000
FailedReason = Shell_SendKeysWithTimeout(oShell, CmdTxt, 1000)
沒有留言:
張貼留言