Reputation: 2879
I want to use ffmpeg via windows batch to convert .wav files and put them in a new directory. For each file, I want to do the command
ffmpeg -y -i H:\input\file_10;18;33.wav H:\output\file_10_18_33.wav
Notice that the ; in the old filename are replaced by _ in the new filename.
So I will have to do something like
for %f1 in (H:\input\*.wav) do ffmpeg -y -i %f H:\output\%f2
But meanwhile, %f2 should be the filename of %f1 with the semicolons replaced by underscores. How can I do this?
Upvotes: 0
Views: 1636
Reputation: 9033
Try this:
for %f in (H:\input\*.wav) do set f2=%f & ffmpeg -y -i %f %f2:;=_%
Good luck!
Upvotes: 2
Reputation: 26140
You can use the variable "in place" edit and replace :
c:\>set f1="aaa;bbb;ccc"
c:\>set f2=%f1:;=_% #rem will replace all ; by _ in the %f1% var
C:\>echo %f2%
aaa_bbb_ccc
Upvotes: 3