Search code examples
batch-filecmdffmpegshutdown

Exit cmd (or shutdown) after ffmpeg done


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.


Solution

  • 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