【发布时间】:2015-05-07 19:40:01
【问题描述】:
我正在制作一个批处理文件以将文件上传到 SFTP 服务器上的一个特定文件夹。当我使用任务计划程序运行文件时,它没有显示任何错误,但客户端的 SFTP 文件夹上没有上传任何内容。这是我的批处理脚本:
@echo off
REM Defines an exiting variable to be added onto each file giving it a time-stamp and exiting the current instance of WinSCP.
set d=%date:~-4,4%%date:~4,2%%date:~-7,2%
set d=%d: =_%
REM Creates the variable lines to shorten the SFTP file upload.
REM Example usage --> %transferStart%ourFile.txt %transferEnd%TheirFile.txt%e%
SET upload=winscp.exe /console /command "option confirm off" "open sftp://user:pass@example.com" "c:\apps\ftpfiles\name_%d%.txt" "put \\mainfolder\inbound\" "close"
【问题讨论】:
-
你是否缺少结尾的右引号?
-
不,在原始版本中我有结束代码,我也在这里添加。感谢您让我知道这一点。
-
代码里有,还是没有结果。
-
我还添加了“-hostkey="ssh-rsa 22 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx: xx" 在我的 sftp open 语句的末尾,但它没有改变任何东西
-
c:\apps:\ftpfiles\name_%d%.txt在apps之后有一个:,这是无效的。
标签: batch-file sftp winscp