I've batch script that runs winscp with script, and sometimes WinSCP hangs when is "Connecting to host".
Is it possible to set timeout that WinSCP stops trying to connect and shuts it's self after x seconds when cannot connect?
I've batch script that runs winscp with script, and sometimes WinSCP hangs when is "Connecting to host".
Is it possible to set timeout that WinSCP stops trying to connect and shuts it's self after x seconds when cannot connect?
On you open command you can set a timeout parameter
-timeout=<sec>
Example:
open sftp://martin:[email protected]/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" -timeout=30
A default timeout is 15 seconds. You can change it using the -timeout
switch of the open
command. Though in some cases, Windows does not respect the timeout and may use longer (or shorter).
When a connection fails (or times out), WinSCP will retry the connection. In the default "batch" mode, WinSCP will keep re-trying for up to 2 minutes. In an interactive mode, it keeps trying forever.
You can change the limit using the option reconnecttime <sec>
command.
Examples:
option batch abort
option reconnecttime 60
open sftp://[email protected]/ -timeout=15
option reconnectime 60
I get Unknown option 'reconnectime'.
. Try instead using reconnecttime
.
Aug 9, 2018 at 21:38