Tag: 腻子

Putty和Excel之间的互动(vba)

我一直试图通过从Excel中的VBA腻子自动化以下步骤 login到腻子 执行一个命令 复制putty的结果并粘贴到excel中。 到目前为止,我已经编写了通过启动putty应用程序来login到服务器的代码(请参阅下面的代码) Sub Putty() Dim TaskID As Long TaskID = Shell("path/putty.exe servername", vbNormalFocus) AppActivate TaskID, True SendKeys "username" SendKeys "{ENTER}" SendKeys "password" SendKeys "{ENTER}" '—- Here i need to execute a command for eg: "ls -l" and copy the result into Excel End Sub 您能否介绍一下在这一步之后如何执行命令,并将结果从putty复制到Excel?

打开PuTTY并在服务器上运行shell脚本

我想从本地机器打开Putty,自动login到服务器,并使用Excel VBA Script在同一个putty会话上运行shell脚本。 下面的代码工作正常打开putty。 Sub open_putty() Dim UserName 'assign user name Dim Passwrd 'assign password Dim TaskID As Long pc1 = "C:\Users\Desktop\putty.exe -ssh " & UserName & "@servernamee -pw " & Passwrd TaskID = Shell(pc1, 1) End Sub 但是,我无法在同一个会话上运行shell脚本test.sh。 该脚本在login后处于默认位置。 我如何使用Excel VBA在服务器上运行shell脚本。