Batch file 如何从批处理文件执行WinSCP命令

Batch file 如何从批处理文件执行WinSCP命令,batch-file,command-line,sftp,winscp,Batch File,Command Line,Sftp,Winscp,我想知道是否有一种方法可以从批处理文件中运行WinSCP命令,如open sftp…,而不必在WinSCP打开后输入命令 以下是我想要发生的事情: 我创建了一个批处理文件(比如demo.bat),用于打开WinSCP命令行 我在demo.bat中插入WinSCP命令(open,get,put,等等) 批处理文件demo.bat打开WinSCP命令行并自动执行命令(get,put,等等) 使用 有一个 使用/command开关的简单批处理文件如下所示: WinSCP.com ^ /log="C

我想知道是否有一种方法可以从批处理文件中运行WinSCP命令,如
open sftp…
,而不必在WinSCP打开后输入命令

以下是我想要发生的事情:

  • 我创建了一个批处理文件(比如
    demo.bat
    ),用于打开WinSCP命令行
  • 我在
    demo.bat
    中插入WinSCP命令(
    open
    get
    put
    ,等等)
  • 批处理文件
    demo.bat
    打开WinSCP命令行并自动执行命令(
    get
    put
    ,等等) 使用

    有一个

    使用
    /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实际上甚至可以:


    WinSCP甚至可以选择为您创建这样的批处理文件: