.BAT - 使用参数启动.exe,其中.exe位置和参数是字符串

时间:2012-10-28 01:10:59

标签: string batch-file location

尝试使用以下代码在.bat文件中运行以下命令

c:\program files (x86)\Team Mediaportal\Mediaportal\TV Thumbnailer\ffmpeg.exe -ss 720 -itsoffset -5 -i "c:\tv recordings\sample recording.mpg" -vframes 1 -y "C:\tv recordings\sample recording.jpg"

Set "FFMpeg_Location=c:\Program Files (x86)\Team Mediaportal\Mediaportal\TV Thumbnailer"

rem or Set "FFMpeg_Location=c:\Program Files (x86)\Team Mediaportal\Mediaportal\TV Thumbnailer\ffmpeg.exe" , whichever is easier :D

Set "Video_Path=c:\tv recordings\"

Set "Video_File=sample recording"

%FFMpeg_Location%\FFMpeg.exe -ss 720 -itsoffset -5 -i "%Video_Path%%Video_File%.mpg" -vframes 1 -y "%Video_Path%%Video_File%.jpg"

PS。我希望.fat在ffmpeg运行完毕后继续,因为我使用ffmpeg来处理for循环中的很多文件。此外,我不想通过执行cd c:\ pro ... \ tv thumbnailer \来更改.bat文件的工作目录,因为这会破坏我的脚本。


编辑:我使用call语句解决了我的问题:D

call "%FFMpeg_Location%\FFMpeg.exe" -ss 720 -itsoffset -5 -i "%Video_Path%%Video_File%.mpg -vframes 1 -y "%Video_Path%%Video_File%.jpg"

1 个答案:

答案 0 :(得分:2)

调用“%FFMpeg_Location%\ FFMpeg.exe”-ss 720 -itsoffset -5 -i“%Video_Path %% Video_File%.mpg -vframes 1 -y”%Video_Path %% Video_File%.jpg“