您可以尝试使用“shell”函数创建命令窗口,然后通过“sendKeys”函数向其发送ssh命令和参数。但是,这将是一个容易出错的解决方案。
如果您想要更持久的修复,请查看this VB Library for SSH manipulation。你可能会发现它有用。这是a sample project的链接。
编辑:
我没有VB6 IDE所以我重用了之前创建的VBScript文件。它既可以按原样运行,也可以非常容易地转换为VB6代码。
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "C:\Windows\System32\telnet.exe"
WScript.Sleep(1000)
objShell.SendKeys "o telnet.example.com"
WScript.Sleep(1000)
objShell.SendKeys "{enter}"
WScript.Sleep(10000)
objShell.SendKeys "user"
WScript.Sleep(2000)
objShell.SendKeys "{enter}"
WScript.Sleep(1000)
objShell.SendKeys "pass"
WScript.Sleep(2000)
objShell.SendKeys "{enter}"
WScript.Sleep(1000)
objShell.SendKeys "./var/tmp/task.pl"
WScript.Sleep(1000)
objShell.SendKeys "{enter}"
WScript.Sleep(1000)