excel - 在 VBA 宏中使用 SSH 传递命令但无法在 excel 上获得响应
问题描述
使用 Windows 的 Excel VBA 中的 SSH 输出出现问题。
我曾尝试使用 SSH 运行相同的东西,它工作正常,但是当我尝试使用 VBA 时,它显示它正在工作,但没有显示任何内容。
Sub CreateSSHTunnelUsingPutty()
Dim strFilename As String, strCommandLine As String
Dim strCurrPath As String
Dim lngWindowHandle As Long
Dim strServerPOrt As Long
Dim strServerUser As String
Dim strServerPassword As String
Dim IPAdd As String
Dim rng As Range, cell As Range
strServerPOrt = 22 'Sample POrt
strServerUser = "username" 'Sample User Name
strServerPassword = "password" 'Sample Password
'Set rng = Range("B2:B75")
For Each cell In ActiveSheet.Range("B2:B2")
IPAdd = cell.Value
strFilename = "Plink.exe"
strCommandLine = IPAdd & " -P " & strServerPOrt & " -l " & strServerUser & " -pw " & strServerPassword
'Launch tunnel
Call lbf_ShellExecute(0, "open", strFilename, strCommandLine, "", 1)
'Change the last parameter from a one to a zero and the connection window will be hidden.
Sleep (3000)
'Here i want to give my commands so that output will be displayed on Sheet 1 Starting Row 3
End Sub
可以说,如果我放版本,那么它应该显示版本或 top 命令将导致所有内存详细信息。
解决方案
推荐阅读
- swift - 如何在 HomeVC 中快速提供 xib 单元格按钮操作
- reactjs - 如何在 react-apollo 中等待多个 useLazyQuery
- python - Why Django unique constraints did not work?
- css - CSS 网格未正确加载
- jquery - 如何使用 jquery 在 HTML 表中显示 json 内容
- python - Python刮板未正确写入csv
- android - 具有拐角半径背景的 Recyclerview
- python - 使用 Python 向灰度图像添加噪声的问题
- python - 为什么 for 循环在冒泡排序中会出错?
- android-fragments - 通过内部 DialogFragment 片段传递数据