Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a batch file to process videos and rename the output file automatically.

I've got this so far:

d:\audio\ffmpeg.exe -i "%~1" -vcodec copy -acodec libvo_aacenc -af volume=3.0 "%~1"

The last "%~1" will overwrite the initial file. What I'd like is that they append something to the back of the file, for example:

filename.avi will return filename1.avi

How do I go about doing that?

share|improve this question
Why the tilde in %~1? Shouldn't that just be %1? Anyway just try appending a 1 and make it %11. The % placeholder only goes up to 9, so two digits are not interpreted as a number > 10 – Jan Doggen Aug 22 '13 at 7:58
Cos I'm drag-n-dropping a file onto the BAT and my video files have long path names with spaces in it. I tried added 1 behind, but ffmpeg does not recognize .avi1 as a file type and will break. Optimally I would like to concatenate the last 4 chars, edit the filename, append the last 4 chars back in. – kinobe Aug 22 '13 at 8:30
up vote 1 down vote accepted

Appends random number to output file name.

set output=%~dpn1%random%%~x1
d:\audio\ffmpeg.exe -i "%~1" -vcodec copy -acodec libvo_aacenc -af volume=3.0 "%output%"
share|improve this answer
This worked! Thanks!.... now to figure out what you did there. I'd like to append a fixed wording like "fixed" to the end instead of random numbers. – kinobe Aug 22 '13 at 9:31
And it's as simple as removing %random% and replacing it with whatever I want :) thanks again! – kinobe Aug 22 '13 at 9:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .