在 Excel VBA 中将 -speed 开关添加到命令行 WinSCP 代码

Adding -speed switch to command line WinSCP code in Excel VBA

我有一个 excel VBA 脚本来获取文件并将其上传到我的 FTP 站点。我想做的是在命令中添加一个 -speed 开关,以将传输速度限制在 700k 左右。我现在有以下代码,效果很好,只是没有限制:

Call Shell( _
"C:a7j42w\WinSCP\WinSCP.com /log=C:a7j42w\WinSCP\excel.log /command " & _
"""open ftp://xxxxxxx:xxxxxxx@ftp.kaltura.com/"" " & _
"""put """"" & RealFile & """"""" " & _
"""exit""")

我从此处的 WinSCP 页面 (https://winscp.net/eng/docs/scriptcommand_put) 知道我需要在 put 命令后添加一个 -speed=<700>,但我对所有引号感到困惑,和这个速度开关的位置。我尝试在 put 命令之后添加它,所以它是这样的:

"""put -speed=<700>""""" & RealFile & """"""" " & _

但这没有用。我还尝试在 700 后面的右括号后面和引号前面添加另一个 space,但这也不起作用。

我确定我没有将它放在正确的位置或未正确执行 quotes/spaces,但我不确定从这里到哪里去。任何帮助将不胜感激。

不是-speed=<700>,而是-speed=700。此外,您在切换后错过了 space。

所以正确的代码是:

"""put -speed=700 """"" & RealFile & """"""" " & _

参考:https://winscp.net/eng/docs/scriptcommand_put