【问题标题】:How to execute WinSCP commands from a batch file如何从批处理文件执行 WinSCP 命令
【发布时间】:2018-12-25 07:29:41
【问题描述】:

我想知道是否有一种方法可以从批处理文件运行 WinSCP 命令,例如 open sftp...,而无需在 WinSCP 打开后输入命令。

这就是我想要发生的事情:

  1. 我创建了一个打开 WinSCP 命令行的批处理文件(比如demo.bat)。
  2. 我在demo.bat中插入WinSCP命令(opengetput等)。
  3. 批处理文件demo.bat打开WinSCP命令行并自动执行命令(getput等)。

【问题讨论】:

标签: batch-file command-line sftp winscp


【解决方案1】:

使用/command or /script command-line switches

有一个guide to automating file transfers to SFTP server with WinSCP

使用/command 开关的简单批处理文件如下:

WinSCP.com ^
  /log="C:\writable\path\to\log\WinSCP.log" /ini=nul ^
  /command ^
    "open sftp://username:password@example.com/" ^
    "put C:\local\path\file.txt /remote/path/" ^
    "exit"

而且 WinSCP GUI 其实甚至可以generate the batch file for you:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-23
    • 2011-08-27
    • 1970-01-01
    • 2015-01-06
    • 1970-01-01
    • 2012-07-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多