如何从批处理文件中执行 WinSCP 命令
How to execute WinSCP commands from a batch file
我想知道是否有办法从批处理文件中 运行 WinSCP 命令,如 open sftp...
,而无需在 WinSCP 打开后输入命令。
这是我想要发生的事情:
- 我创建了一个打开 WinSCP 命令行的批处理文件(比如
demo.bat
)。
- 我在
demo.bat
. 中插入 WinSCP 命令(open
、get
、put
等)
- 批处理文件
demo.bat
打开WinSCP命令行并自动执行命令(get
、put
等)。
使用/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:
我想知道是否有办法从批处理文件中 运行 WinSCP 命令,如 open sftp...
,而无需在 WinSCP 打开后输入命令。
这是我想要发生的事情:
- 我创建了一个打开 WinSCP 命令行的批处理文件(比如
demo.bat
)。 - 我在
demo.bat
. 中插入 WinSCP 命令( - 批处理文件
demo.bat
打开WinSCP命令行并自动执行命令(get
、put
等)。
open
、get
、put
等)
使用/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: