0

I am trying to convert m3u8 files to an mp4 file using FFmpeg, I wrote a batch script that asks the user to enter the URL for the m3u8 file, when I enter the URL for the first time the variable %url% states empty when I enter the value for the second time it holds the input from the first input and ignore the new input

@echo off 

setlocal 

:while

set /p "choice=Enter q to quit , e to continue : "

if %choice% == e (
    set /p "url=Enter file url ( .m3u8 ) : "
    echo "%url%"
    ffmpeg -i %url% -c copy "%random%.mp4"
    pause
    cls
    goto :while
) else (
    if not "%choice%" == "q" goto :while
)
cls
endlocal

e.g if I enter for the first time "example.m3u8" it will print and use an empty string when I enter for the second time "example2.m3u8" it will print and use "example.m3u8".

I hope someone will have an explanation for this problem and thank you for your time.

obeda
  • 82
  • 10
  • 1
    I would advise you as a best practice to use the [CHOICE](https://ss64.com/nt/choice.html) command for user input. – Squashman Oct 01 '21 at 15:04
  • 1
    Why do you use quotation marks to check against `q` but not for the check against `e`? – aschipfl Oct 01 '21 at 16:59

0 Answers0