gpt4 book ai didi

excel - 腻子:网络错误:无法分配请求的地址

转载 作者:行者123 更新时间:2023-12-04 20:28:29 25 4
gpt4 key购买 nike

您好,我已经编写了一个宏来 ssh 到服务器,其用户名和密码分别存储在 A1 和 B1 中。当宏被调用时,腻子抛出错误网络错误:无法分配请求的地址

Sub putty()
Dim un As String, pwd As String, pcmd As String, pline As String
Dim shellObj As Object, runCmd As Object, sOut As Object

un = Range("A1").Value
pwd = Range("B1").Value
Set shellObj = CreateObject("WScript.Shell")
pcmd = "C:\Program Files\PuTTY\putty.exe " & un & "@15.xx.xx.xx -pw " &
pwd & " who"
Set runCmd = shellObj.exec(pcmd)
Set sOut = runCmd.StdOut

While Not sOut.AtEndOfStream
pline = sOut.ReadLine
Debug.Print pline
Wend
End Sub

是否有任何解决方法。

最佳答案

一种选择是直接使用 -P <port> 指定端口。 (例如,-P 22),根据文档:
https://the.earth.li/~sgtatham/putty/0.74/htmldoc/Chapter5.html#pscp-usage
即使注册表中没有存储“默认设置” session ,PuTTY UI 似乎默认将端口值显示为 22,所以它似乎是有效的,即使它不是。解决此问题的方法是启动 PuTTY,选择“默认设置”,然后单击加载/保存。
编辑:
这是 PuTTY 0.74 (https://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/pscp-port-0.html) 中的一个已知错误。

关于excel - 腻子:网络错误:无法分配请求的地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54479401/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com