在WinSCP中出现“未知命令”错误。

huangapple go评论48阅读模式
英文:

Getting "Unknown command" error in WinSCP

问题

以下是代码部分的中文翻译:

我尝试使用任务计划程序和WinSCP自动发送一个.xlsx文件通过SFTP。我可以让WinSCP启动并成功验证,但很快返回以下内容并关闭连接:

< 2023-04-03 19:44:36.835 脚本: 活动会话: [1] [已编辑]
> 2023-04-03 19:44:36.835 脚本: 目录/
< 2023-04-03 19:44:36.835 脚本: 未知命令 'directory'。
. 2023-04-03 19:44:36.836 脚本: 失败
. 2023-04-03 19:44:36.837 脚本: 退出代码: 1
. 2023-04-03 19:44:36.837 关闭连接。

我尚未找到解决未知命令 'directory' 的方法。

任务计划程序参数:

/script=C:[已编辑]Script.txt /log=C:[已编辑]Log.txt

脚本文件:

# 使用提供的用户名和密码连接到SFTP服务器
open sftp://username:password@[已编辑]
# 将位于指定路径(本地目录)的TB文件复制到根目录
directory of /
# -nopreservetime = 忽略WinSCP关于文件时间戳记录的错误
# -resumesupport=off = 禁用文件部分扩展,以确保WinSCP传输文件而不拆分文件
# -delete = 在文件发送后清除本地目录,因为未来的TB将替代它
put C:[已编辑]\*.xlsx / -nopreservetime -resumesupport=off
英文:

I'm trying to automate sending a .xlsx file via SFTP using Task Scheduler and WinSCP. I can get WinSCP to launch and successfully authenticate, however it soon after returns the following and closes the connection

&lt; 2023-04-03 19:44:36.835 Script: Active session: [1] [redacted]
&gt; 2023-04-03 19:44:36.835 Script: directory of /
&lt; 2023-04-03 19:44:36.835 Script: Unknown command &#39;directory&#39;.
. 2023-04-03 19:44:36.836 Script: Failed
. 2023-04-03 19:44:36.837 Script: Exit code: 1
. 2023-04-03 19:44:36.837 Closing connection.

I haven't been able to figure out how to resolve the unknown command 'directory'.

Task Scheduler Arguments:

/script=C:[redacted]Script.txt /log=C:[redacted]Log.txt

Script file:

# Connect to SFTP server using username and password supplied
open sftp://username:password@[redacted]
# put the TB file(s) stored at the specified path (local directory) to the root
directory of /
# -nopreservetime = swallow a WinSCP error about logging a timestamp on the file
# -resumesupport=off = disable filepart extension to ensure WinSCP transfers the file
without disassembling
# -delete = clears the local directory after the file has been sent, since the future
TB will supersede it
put C:[redacted]\*.xlsx / -nopreservetime -resumesupport=off

答案1

得分: 1

Sure, here's the translated content:

似乎您的一些注释行在某个地方被换行了,而被换行的部分并不以#开头,因此WinSCP尝试将它们解释为命令并失败。

应该是:

# 将存储在指定路径(本地目录)的TB文件发送到/的根目录
# -nopreservetime = 忽略WinSCP关于记录文件时间戳的错误
# -resumesupport=off = 禁用文件部分扩展,以确保WinSCP在不拆卸文件的情况下传输文件
# -delete = 在文件发送后清除本地目录,因为将来的TB将取代它
英文:

It looks like some of your comment lines got wrapped somewhere on the way, And as the wrapped parts do not start with #, WinSCP tries to interpret them as commands and fail.

It should be:

# put the TB file(s) stored at the specified path (local directory) to the root directory of /
# -nopreservetime = swallow a WinSCP error about logging a timestamp on the file
# -resumesupport=off = disable filepart extension to ensure WinSCP transfers the file without disassembling
# -delete = clears the local directory after the file has been sent, since the future TB will supersede it

huangapple
  • 本文由 发表于 2023年4月4日 08:01:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/75924554.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定