2016-12-24 76 views
0

我正在运行一个批处理文件,以使用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?

+3

“newfiles \ %%〜nA.mov” – elzooilogico

+0

帮助,如果你读你试图使用这些命令的文档。 – Squashman

回答

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

相关问题