Search found 23 matches

by Reino
24 May 2015 14:27
Forum: DOS Batch Forum
Topic: Newline character as delimiter in for-loop
Replies: 11
Views: 19001

Re: Newline character as delimiter in for-loop

This isn't about ignoring lines with eol=x, but the other way around, so I can't use your code. I want to create a singleline of youtube-dl's multiline output, by using CRLF as a delimiter, so I can "tokenize" it into 2 variables. You're saying I can't? I've tried... FOR /F "tokens=1,...
by Reino
24 May 2015 07:18
Forum: DOS Batch Forum
Topic: Newline character as delimiter in for-loop
Replies: 11
Views: 19001

Newline character as delimiter in for-loop

I have the following situation: youtube-dl.exe -gf 135+141 https://www.youtube.com/watch?v=KpvLMyC4a8o https://r3---sn-mn4vg5aa-5hns.googlevideo.com/...longurl... https://r3---sn-mn4vg5aa-5hns.googlevideo.com/...longurl... When you want youtube-dl to return the videolink of 2 formats of a certain vi...
by Reino
18 May 2015 08:17
Forum: DOS Batch Forum
Topic: Pipe in for loop breaks double quoted variables
Replies: 11
Views: 11136

Re: Pipe in for loop breaks double quoted variables

CMD /C only strips the outer quotes if the very first character is a quote. So I simply put an extra space before the command. SET curl="C:\map with spaces\curl.exe" SET jq="C:\map with spaces\jq-1.5rc1.exe" ... FOR %%A IN ("%url%") DO ( FOR /F "delims=" %%B ...
by Reino
17 May 2015 11:23
Forum: DOS Batch Forum
Topic: Pipe in for loop breaks double quoted variables
Replies: 11
Views: 11136

Re: Pipe in for loop breaks double quoted variables

I see. Understood. Thanks a lot!
by Reino
17 May 2015 10:09
Forum: DOS Batch Forum
Topic: Pipe in for loop breaks double quoted variables
Replies: 11
Views: 11136

Re: Pipe in for loop breaks double quoted variables

So if I understand correctly, the issue was never about spaces in a directory name, or the presence of a pipe, but rather the presence of parenthesis in the jq-command! But why then isn't it necessary to put the entire command between ' ^" ' when curl.exe and jq.exe are called directly? The par...
by Reino
17 May 2015 05:49
Forum: DOS Batch Forum
Topic: Pipe in for loop breaks double quoted variables
Replies: 11
Views: 11136

Re: Pipe in for loop breaks double quoted variables

Thanks to Dave Benham's answer on a related issue I've found the solution! It appeared to be a specific FOR /F bug in WinXP, and guess what, here I'm still on WinXP. To fix the main offender, the curl-pipe-jq-for-loop, I had to put ' ^" ' in front of and after the entire command, like (' ^"...
by Reino
15 May 2015 15:11
Forum: DOS Batch Forum
Topic: Pipe in for loop breaks double quoted variables
Replies: 11
Views: 11136

Re: Pipe in for loop breaks double quoted variables

I didn't know %%~nxA would also work for urls. Nice! I've further worked out my script: @ECHO off CLS :: NPO JSON-extractor geschreven door Reino Wijnsma, 2015 (reino@degeelebosch.nl) SET batchname=NPO JSON-extractor SET version=1.1 TITLE %batchname% %version% SET curl="C:\map with spaces\curl....
by Reino
14 May 2015 07:13
Forum: DOS Batch Forum
Topic: Pipe in for loop breaks double quoted variables
Replies: 11
Views: 11136

Pipe in for loop breaks double quoted variables

Situation: Using batchscript to retrieve certain values from a JSON. I've got the following batchscript: @ECHO off SET url=http://www.npo.nl/buitenhof/03-05-2015/VPWON_1232766/POMS_VPRO_850040 FOR /F "tokens=6 delims=/" %%A IN ("%url%") DO ( FOR /F "delims=" %%B IN ('cu...