1

Topic: with goto loop inside for - a premature output from for?

All kind time of days. Is following

cls
SETLOCAL EnableDelayedExpansion
echo off
FOR/F "tokens=1,2 delims =," %% i in (dlist.txt) do (
set dfile = "docs / %% ~i"
set dlink = %% ~j
echo! dfile!-! dlink! - start
:dl
"put_k_kurlu\curl.exe" -# - tlsv1-4-L0-o! dfile!! dlink!
IF NOT EXIST! dfile! (
echo! dfile! - retry
goto dl
)
)

the File dlist.txt contains lines of a type

 "file name", " a file" 

It was not primary goto a cycle, but the server from which there is a downloading, it is frequent and it is unpredictable threw out errors ssl connections.
However after adding goto the first line of a file then  it is completed without error messages (without goto a cycle began to be processed only were processed all the line long, but the most part of files simply was not downloaded)
[spoiler a console output:]

 D:\tmp \_ sb> SETLOCAL EnableDelayedExpansion
D:\tmp \_ sb> echo off
"_" -  - start
curl: (35) Unknown SSL protocol error in connection to :443
"_" - retry
curl: (35) Unknown SSL protocol error in connection to :443
"_" - retry
<Still a heap of repetitions...>
curl: (35) Unknown SSL protocol error in connection to :443
"_" - retry
######################################################################## 100.0 %
D:\tmp \_ sb> 

[/spoiler]
The question - why here happens an output from FOR after single line handling?

2

Re: with goto loop inside for - a premature output from for?

I will add - while goto does not work (i.e. if the file is downloaded from the first attempt), lines are processed normally. Itself goto the cycle is fulfilled until the file will not be downloaded. Right after it there is an output from for.

3

Re: with goto loop inside for - a premature output from for?

Exterior process should be launched as start/w cmd/c a command - then the execution context does not float.

4

Re: with goto loop inside for - a premature output from for?

astart wrote:

...
"put_k_kurlu\curl.exe" -# - tlsv1-4-L0-o! dfile!! dlink!
...

the File dlist.txt contains lines of a type

That you such strange...
If it is impossible to prepare at once a file of the necessary format took a source code, transformed it to a format, understood curl th and fed this file one command.
P.S. If it would be desirable to process in a cycle a difficult command batch:

 call/?
...
Command CALL admits usage of labels as the addressee of a call.
The following syntax is applied:
CALL: arguments
...

5

Re: with goto loop inside for - a premature output from for?

Basil A. Sidorov wrote:

transformed it to a format, understood curl th and fed this file one command.

And this construction safely passes all files with an error 35, whether not so?
Akina, thanks for council.

6

Re: with goto loop inside for - a premature output from for?

astart wrote:

And this construction safely passes all files with an error 35, whether not so?

 curl - help|find "retry"
--retry <num> Retry request if transient problems occur
--retry-connrefused Retry on connection refused (use with - retry)
--retry-delay <seconds> Wait time between retries
--retry-max-time <seconds> Retry only within this period 

7

Re: with goto loop inside for - a premature output from for?

Basil A. Sidorov, "... But there is one nuance" ()

wrote:

- retry <num>
If a transient error is returned when curl tries to perform a transfer, it will retry this number of times before giving up. Setting the number to 0 makes curl do no retries (which is the default). Transient error means either: a timeout, an FTP 4xx response code or an HTTP 5xx response code .

m., together with retry-connrefused it will work. And can, and will not be.

8

Re: with goto loop inside for - a premature output from for?

astart wrote:

m., together with retry-connrefused it will work. And can, and will not be.

I do not have at hand server which more or less stablly produces errors.
Also I download, normally, wget th which is much easier curl on the most typical task.
I summarize.
To me it is easy, to look for you at the help produced by the utility, but I am not going to check, how much it approaches you.