# Batch file trouble with literals & escape charaters



## Louv (Sep 6, 2008)

*OS:* Vista Ultimate
*Script:* Batch file
*Goal:* I'm writing a batch file that needs to call "ffmpeg" to create a movie from a series of jpeg files.

ffmpeg requires the list of jpegs to be specified with this string on the command line: %03d.jpg

My problem is that the batch file expands the "%0" out to be the string used to call this function.

Here's the exact string I'm using in the batch file:

call ffmpeg.lnk -i %base%\temp\stills\%03d.jpg -y -an %base%\temp\n%1-%2-%3.mp4

I've tried escaping the % with ^ and %% and %%%% and with single, double, and back quotes. No joy.

I have not yet tried expanding the whole string into a file, and then calling the file. That seems inelegant, but worth some experimentation...

Any help would be appreciated.


----------



## Squashman (Apr 4, 2003)

You tried put the paths is quotes?


----------



## TheOutcaste (Aug 8, 2007)

Use this:

```
[SIZE=3][B]call ffmpeg.lnk -i %base%\temp\stills\[COLOR=Red]%%%[/COLOR]%03d.jpg -y -an %base%\temp\n%1-%2-%3.mp4[/B][/SIZE]
```
It must be exactly 4 percent symbols. The first batch file will reduce that to 2 (*%%0*) and pass *%%0* to ffmpeg. This will then get reduced to 1 (*%0*) without being seen as a batch parameter.

This works calling another batch file, so I would assume that ffmpeg will accept it this way.

In an echo statement, you just need to escape the number and double the percent symbol like this: %%^0

HTH

Jerry


----------

