ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.33k stars 10.03k forks source link

output template in Windows ... #30015

Closed Albretch closed 2 years ago

Albretch commented 3 years ago

Checklist

Verbose log

[youtube] zwwi2bcl1Lg: Downloading webpage
[debug] Default format spec: bestvideo+bestaudio/best

Description

On windows I am trying to log one liners with the uploader title id and extension. I copy the text from a file and paste it on the command prompt. The same procedure works when I download files, but not when I try to get some metadata.

set IBATCHFL=cashless_society00_yt.txt set LOGFL=%IBATCHFL%_2021092411234.log echo %LOGFL%

youtube-dl.exe --simulate --output "%%(uploader)s\%%(title)s_%%(id)s.%%(ext)s" --batch-file %IBATCHFL% >> %LOGFL% 2>&1

Albretch commented 3 years ago

On WIndows 10 and I have tried using single quotes as well

dirkf commented 3 years ago

In the batch file, %%(var)s.

On the command line, just %(var)s.

https://ss64.com/nt/syntax-percent.html

rautamiekka commented 3 years ago

set IBATCHFL=cashless_society00_yt.txt set LOGFL=%IBATCHFL%_2021092411234.log echo %LOGFL%

youtube-dl.exe --simulate --output "%%(uploader)s%%(title)s_%%(id)s.%%(ext)s" --batch-file %IBATCHFL% >> %LOGFL% 2>&1

Remember that Command Prompt is a bigger bitch than Bash when it comes to vars: 1) always double-quote var refs: "%IBATCHFL%". 2) and when assigning a var (Command Prompt doesn't implicitly quote var assignments):

set "IBATCHFL=cashless_society00_yt.txt"

(not set IBATCHFL="cashless_society00_yt.txt")