Search code examples
youtubewindows-10filenamesyoutube-dl

Youtube-dl OUTPUT TEMPLATE %(title)s.%(ext)s is not working with set /p in windows


I used the batch file with commands :-
set /p ytlink="Enter the link of Youtube Video:- "
youtube-dl -f "bestvideo[height<=1080]+bestaudio/best[height<=1080]" -o "D:\Videos\%(title)s.%(ext)s" %ytlink%
pause

but the output file name is (ext)s.webm ,it seems cmd is treating %(title)s.% in -o "D:\Videos\%(title)s.%(ext)s" as variable.So how to get video title?
OS=Windows 10 64bit 1909
youtube-dl=2020.01.24


Solution

  • You have to use double % in a batch file.

       set /p ytlink="Enter the link of Youtube Video:- "
    youtube-dl -f "bestvideo[height<=1080]+bestaudio/best[height<=1080]" -o "D:\Videos\%%(title)s.%%(ext)s"     %ytlink%
    pause