我正在运行批处理文件以使用FFMPEG转换目录中具有* .MTS扩展名的所有文件。
for %%A in (*.MTS) do ffmpeg -i "%%A" -vcodec copy -acodec pcm_s16le -ar 48000 -ac 2 "newfiles\%%A.mov"
pause
输出文件转到名为newfiles的目录。转换没有问题。问题是,如果输入是文件名.MTS输出是文件名.MTS.mov
如何更改批处理文件,以便输入name.MTS,输出为name.mov?
答案 0 :(得分:2)
除了普通的for
循环变量之外,您还可以使用其他语法来更改输出。从for /?
的输出:
%~I - expands %I removing any surrounding quotes (")
%~fI - expands %I to a fully qualified path name
%~dI - expands %I to a drive letter only
%~pI - expands %I to a path only
%~nI - expands %I to a file name only
%~xI - expands %I to a file extension only
%~sI - expanded path contains short names only
%~aI - expands %I to file attributes of file
%~tI - expands %I to date/time of file
%~zI - expands %I to size of file
因此,在您的情况下,您将使用newfiles\%%~nA.mov