【问题标题】:WinSCP script will not exit after error, even with "option batch abort"错误后 WinSCP 脚本不会退出,即使使用“选项批处理中止”也是如此
【发布时间】:2014-12-31 19:47:59
【问题描述】:

由于某种原因,当我的网络中断时,我的脚本不会中止。

命令如下:

"%~dp0\winscp.exe" /console /script="script.txt" 
exit

和script.txt:

option batch abort 
option confirm off 
open ftp://user:pass@ftp.site.com/ 
cd /directory/ 
synchronize local
exit

当我拉我的网线(测试网络掉线)时,我得到:

The requested name is valid, but no data of the requested type was found. 
Connection failed. 
(A)bort, (R)econnect (5 s): 
.. 
(A)bort, (R)econnect (0 s): Reconnect

它将继续无限期地尝试重新连接。

为什么脚本不自动中止?我正在使用option batch abort。我错过了什么吗?

【问题讨论】:

    标签: cmd batch-processing winscp


    【解决方案1】:

    这个错误是可以恢复的,所以即使option batch abortdocumented,WinSCP 也会继续尝试恢复传输:

    ...
    当批处理模式设置为on 时,任何选择提示都会自动得到否定答复。除非提示有不同的默认答案(例如重新连接提示的默认“重新连接”答案),在这种情况下使用默认答案(在很短的时间间隔后)。另请参阅下面的reconnecttime 选项。
    abort 类似于on。 ...

    如上所述,您可以使用option reconnecttime 配置 WinSCP 尝试重新连接的时间。默认情况下,WinSCP 在 on/abort 模式下尝试重新连接 2 分钟。

    请注意,WinSCP 过去默认在旧版本中无限期地重新连接。你一定是用的是旧版本。

    【讨论】:

    • 获取测试版,谢谢!保证下次我会阅读更多内容:D
    猜你喜欢
    • 2022-12-12
    • 2014-11-26
    • 1970-01-01
    • 1970-01-01
    • 2012-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-03
    相关资源
    最近更新 更多