我正在尝试使用WinSCP将文件上传到远程SFTP服务器。当我使用/command
时它可以工作,但是当我使用/script
参数在脚本文件中使用相同的参数时,它会失败。下面是/command
参数工作的cmd截图。
c:\winscp>WinSCP.com /command "open ftps://user:[email protected]/" "put filename.xml" "exit"
Connecting to sf-ftp.ebiaas.com:990 ...
TLS connection established. Waiting for welcome message...
Connected
Starting the session...
Session started.
Active session: [1] [email protected]
filename.xml | 7 KB | 33.6 KB/s | binary | 100%
但是当我使用/script
做同样的事情时,它失败了。
c:\winscp>WinSCP.com /script="C:\Development\UploadData.txt" /log=log.txt
Connecting to sf-ftp.ebiaas.com:990 ...
TLS connection established. Waiting for welcome message...
Access denied.
Authentication failed.
脚本文件UploadData.txt的内容是:
open ftps://user:[email protected]/
put filename.xml
exit
我不确定我是否遗漏了某些内容或以错误的方式使用WinSCP客户端。我读了here,但它只是说如果映射驱动器上的文件失败,访问被拒绝。但是在两种情况下都应该失败。还有另一个帖子here但不确定是否相同。
任何帮助,将不胜感激。
使用/log=c:\path\to\log.log
开关启用两个脚本中的日志记录。还可以使用/loglevel=*
开关启用密码记录。
见https://winscp.net/eng/docs/commandline#logging
并比较两个日志文件,找出造成差异的原因。