To enhance your existing batch script to include options for downloading different video qualities and audio only, you'll need to:
- Use
yt-dlp (which you're already using) to offer options.
- Create a menu system inside the batch file using
choice or simple set /p input.
- Allow users to choose from:
- Best quality video + audio
- Audio only
- Specific video quality (e.g., 1080p, 720p, etc.)
Here’s the enhanced version of your .bat script:
✅ Updated Batch Script with Quality Selection
@echo off
setlocal EnableDelayedExpansion
:: Ask user to paste a URL
set /p url="Paste the URL to download: "
:: Set download folder
set "DOWNLOAD_DIR=%USERPROFILE%\Downloads"
:: Check if it's a YouTube video
echo %url% | findstr /i "youtube.com youtu.be" >nul
if %errorlevel%==0 (
echo Detected YouTube link. Choose download option:
echo 1. Best Video + Audio (MP4)
echo 2. Audio Only (MP3)
echo 3. Choose Specific Video Quality
set /p choice="Enter choice (1/2/3): "
if "!choice!"=="1" (
echo Downloading best video + audio...
yt-dlp -f bestvideo+bestaudio --merge-output-format mp4 --output "%DOWNLOAD_DIR%\%%(title)s.%%(ext)s" "%url%"
)
if "!choice!"=="2" (
echo Downloading audio only...
yt-dlp -x --audio-format mp3 --output "%DOWNLOAD_DIR%\%%(title)s.%%(ext)s" "%url%"
)
if "!choice!"=="3" (
echo Fetching available formats...
yt-dlp -F "%url%"
set /p format_id="Enter Format ID to download: "
yt-dlp -f !format_id! --output "%DOWNLOAD_DIR%\%%(title)s.%%(ext)s" "%url%"
)
) else (
echo Not a YouTube link. Using curl...
:: Try to get file name from URL
for %%F in ("%url%") do (
set "filename=%%~nxF"
)
if "!filename!"=="" (
set "filename=downloaded_file"
)
curl -L -o "%DOWNLOAD_DIR%\!filename!" "%url%"
)
echo.
echo ? Download complete. Saved to: %DOWNLOAD_DIR%
pause
📌 Features Added:
- Option 1: Best video + audio (default MP4).
- Option 2: Audio only (converted to MP3).
- Option 3: Lets the user choose a specific format (shows available options via
yt-dlp -F).
🧰 Requirements:
- Make sure
yt-dlp is installed and accessible from the command line.
curl should be available in Windows (comes by default in Windows 10+).
💡 Tip:
If you're planning to turn this into a GUI app (like with buttons), you'd need to switch to a more advanced language like Python with tkinter, pytube, or yt-dlp bindings.
Let me know if you want a Python GUI version too!