错误引用的空间,找到目标文件路径WinSCP赋予脚本问题 [英] Error quoting spaces to locate destination filepath WinSCP script issue

查看:835
本文介绍了错误引用的空间,找到目标文件路径WinSCP赋予脚本问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个基本的蝙蝠,它可以自动通过下载的WinSCP一组文件文件脚本。我已经使用这个code执行这是工作按预期类似的过程,然而绊脚石似乎是目标文件路径。我已经尝试使用

  C:\\用户\\约翰·史密斯\\ Dropbox的\\ joebloggs \\ DATA \\​​系统数据\\饲料原料\\股票\\日\\

和用引号也内的整个文件路径等的变化。如果任何人都可以进入建议的正确语法此文件路径将是AP preciated。 code是如下: -

 关闭@echo
C:\\ Program Files文件(x86)的\\的WinSCP \\ WinSCP.com^
  / LOG =C:\\用户\\约翰·史密斯\\文档\\ WinSCP.log/ INI = NUL ^
  /命令^
  开放SFTP:// joebloggs:%%40faNliGHT4@82.121.124.146/ -hostkey =SSH-RSA 1024 01:01:DD:1C:54:72:98:C7:42:F9:15:8E:30 :图8c:66:3b中,-passive = 0^
    ^
    搞定/*.txtC:\\用户\\约翰·史密斯\\ Dropbox的\\ joebloggs \\ DATA \\系统数据\\原始订阅\\股票\\日\\^
    出口设置WINSCP_RESULT =%ERRORLEVEL%
如果%WINSCP_RESULT%EQU 0(
  回声成功
)其他(
  回声错误
)退出/ B%WINSCP_RESULT%

错误日志如下: -

 > 2016年5月16日13:32:43.902访问被拒绝
。 2016年5月16日13:32:43.902问用户:
。 2016年5月16日13:32:43.902无法创建文件'C:\\用户\\ John.filepart。 (系统错误code:5。> 2016年5月16日13:32:43.902访问被拒绝)
< 2016年5月16日13:32:43.902脚本:无法创建文件'C:\\用户\\ John.filepart。
< 2016年5月16日13:32:43.902脚本:系统错误。 code:5。> 2016年5月16日13:32:43.902访问被拒绝> 2016年5月16日13:32:43.903类型:SSH_FXP_CLOSE,尺寸:23号:2052
> 2016年5月16日13:32:43.903(EScpSkipFile)无法创建文件'C:\\用户\\ Daniel.filepart。
> 2016年5月16日13:32:43.903系统错误。 code:5。
> 2016年5月16日13:32:43.903访问被拒绝
> 2016年5月16日13:32:43.903脚本:失败
> 2016年5月16日13:32:43.903脚本:退出code:1
> 2016年5月16日13:32:43.903关闭连接。
> 2016年5月16日13:32:43.903发送特殊的code:12
> 2016年5月16日13:32:43.903发送EOF消息


解决方案

您必须将双引号加倍。你也是在 GET 命令的末尾缺少引号(注意三个连续引号)。

 获取,/*.txtC:\\用户\\约翰·史密斯\\ Dropbox的\\ joebloggs \\ DATA \\系统数据\\ ... \\^

(路径缩短,使其鉴于适合)

请参阅有关命令行语法 WinSCP赋予文档。

I've written a basic .bat file script that automates downloading a group of files via WinSCP. I have used this code for performing a similar process which is working as intended, however the stumbling block appears to be the destination filepath. I have tried using

C:\Users\"John Smith"\Dropbox\joebloggs\Data\"System Data"\"Raw Feeds"\Stock\May\

and other variations with the whole filepath within inverted commas also. If anyone could advise the correct syntax for entering this filepath it would be appreciated. Code is as follows:-

@echo off
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\Users\John Smith\Documents\WinSCP.log" /ini=nul ^
  /command ^
  "open sftp://joebloggs:%%40faNliGHT4@82.121.124.146/ -hostkey=""ssh-rsa 1024 01:01:dd:1c:54:72:98:c7:42:f9:15:8e:30:8c:66:3b"" -passive=0" ^
    ^
    "get "/*.txt" "C:\Users\John Smith\Dropbox\joebloggs\Data\System Data\Raw Feeds\Stock\May\" ^
    "exit"

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)

exit /b %WINSCP_RESULT%

Error Log is as follows:-

> 2016-05-16 13:32:43.902 Access is denied
. 2016-05-16 13:32:43.902 Asking user:
. 2016-05-16 13:32:43.902 Can't create file 'C:\Users\John.filepart'. ("System Error.  Code: 5.

> 2016-05-16 13:32:43.902 Access is denied")
< 2016-05-16 13:32:43.902 Script: Can't create file 'C:\Users\John.filepart'.
< 2016-05-16 13:32:43.902 Script: System Error.  Code: 5.

> 2016-05-16 13:32:43.902 Access is denied

> 2016-05-16 13:32:43.903 Type: SSH_FXP_CLOSE, Size: 23, Number: 2052
> 2016-05-16 13:32:43.903 (EScpSkipFile) Can't create file 'C:\Users\Daniel.filepart'.
> 2016-05-16 13:32:43.903 System Error.  Code: 5.
> 2016-05-16 13:32:43.903 Access is denied
> 2016-05-16 13:32:43.903 Script: Failed
> 2016-05-16 13:32:43.903 Script: Exit code: 1
> 2016-05-16 13:32:43.903 Closing connection.
> 2016-05-16 13:32:43.903 Sending special code: 12
> 2016-05-16 13:32:43.903 Sent EOF message

Your have to double the double quotes. You are also missing a quote at the end of the get command (note the three consecutive quotes).

"get ""/*.txt"" ""C:\Users\John Smith\Dropbox\joebloggs\Data\System Data\...\""" ^

(path shortened so that it fits in view)

See WinSCP documentation on command-line syntax.

这篇关于错误引用的空间,找到目标文件路径WinSCP赋予脚本问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆