Skip to content

Instantly share code, notes, and snippets.

@xenophy
Created October 26, 2019 09:52
Show Gist options
  • Save xenophy/d4ffcc45a35b05eb297239792e18536b to your computer and use it in GitHub Desktop.
Save xenophy/d4ffcc45a35b05eb297239792e18536b to your computer and use it in GitHub Desktop.
Selectable BatchFile for ffmpeg(any)
rem preparation command
set pwshcmd=powershell -noprofile -command "&{[System.Reflection.Assembly]::LoadWithPartialName('System.windows.forms') | Out-Null;$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog; $OpenFileDialog.ShowDialog()|out-null; $OpenFileDialog.FileName}"
rem exec commands powershell and get result in FileName variable
for /f "delims=" %%I in ('%pwshcmd%') do set "FileName=%%I"
@echo off
setlocal
set "psCommand="(new-object -COM 'Shell.Application')^
.BrowseForFolder(0,'Please choose a folder.',0,0).self.path""
for /f "usebackq delims=" %%I in (`powershell %psCommand%`) do set "folder=%%I"
setlocal enabledelayedexpansion
echo You chose !folder!
c:\ffmpeg-3.4.2-win64-static\bin\ffmpeg.exe -i %FileName% -vcodec png -r 10 !folder!\image_%%04d.png
endlocal
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment