dimanche 24 avril 2016

Can't put a cer

The following works fine:

@echo off
youtube-dl --output D:\path\%%(title)s.%%(ext)s -f bestaudio https://www.youtube.com/watch?v=J9bjJEjK2dQ

I can add an IF clause (and I get the expected 'hi'):

@echo off
IF 1==1 (
    echo hi
)
youtube-dl --output D:\path\%%(title)s.%%(ext)s -f bestaudio https://www.youtube.com/watch?v=J9bjJEjK2dQ

But when I put youtube-dl in the IF clause, it doesn't work. I get s.%(ext)s was unexpected at this time., without hi.

@echo off
IF 1==1 (
    echo hi
    youtube-dl --output D:\path\%%(title)s.%%(ext)s -f bestaudio https://www.youtube.com/watch?v=J9bjJEjK2dQ
)

Same thing if I put the output path in a variable:

@echo off
set OUTPUT=D:\path\%%(title)s.%%(ext)s
IF 1==1 (
    echo hi
    youtube-dl --output %OUTPUT% -f bestaudio https://www.youtube.com/watch?v=J9bjJEjK2dQ
)

The variable itself is not the problem, as the following works fine:

@echo off
set OUTPUT=D:\path\%%(title)s.%%(ext)s
IF 1==1 (
    echo hi
)
youtube-dl --output %OUTPUT% -f bestaudio https://www.youtube.com/watch?v=J9bjJEjK2dQ

How do I put the thing in the IF clause?

Aucun commentaire:

Enregistrer un commentaire