2

Is there a command to automatically close cmd (or shutdown the pc) after a ffmpeg command have been executed?

I'm using this command to download a video:

ffmpeg -i link.m3u8 -c copy video.mkv

And I want that cmd will close, or the pc will shutdown, after done downloading.

double-beep
  • 5,031
  • 17
  • 33
  • 41
MA.SE
  • 23
  • 1
  • 5

2 Answers2

4

Do you want a batch file or a cmd line?

A batch file (which will shutdown after ffmpeg is complete):

@echo off

ffmpeg -i link.m3u8 -c copy video.mkv
shutdown /p

Or, if you want to exit:

@echo off

ffmpeg -i link.m3u8 -c copy video.mkv
exit /b

For cmd (exits after ffmpeg is complete):

ffmpeg -i link.m3u8 -c copy video.mkv & exit /b

Or, if you want to shutdown:

ffmpeg -i link.m3u8 -c copy video.mkv & shutdown /p
double-beep
  • 5,031
  • 17
  • 33
  • 41
1

You could write a quick little batch file to do this:

start path\to\ffmpeg.exe -i link.m3u8 -c copy video.mkv
exit 
shutdown /s /f /t 0

Obviousy, exit is for exiting cmd and that sequence of shutdown and its associated flags will turn off your PC immediately (if you're doing this, you don't really need to bother exiting cmd since it will do it anyway). Save the above as something like my_file.bat, and then just type path\to\your\my_file.bat into the command prompt.

HFBrowning
  • 2,196
  • 3
  • 23
  • 42