# how do I make a batch file that executes this command

I am trying to make a batch file that executes the following DOS command:

exiftool "-FileName<CreateDate" -d "%Y%m%d_%H%M%S.%%e" "C:\Users\Tom\Desktop\belvedere"


(FYI, exiftool.exe is a script that extracts EXIF data from your digital photos. In the command above I am telling it to look in my desktop\belvedere directory and rename all photos with the Date_Time.extension, e.g. 20120131_113015.jpg)

If I paste the above command into the DOS command prompt, it works fine. However, if I paste this command into a text file, name it something.bat and run this batch file, it does not work well (it renames one photo to be "mHS.JPG" then gives errors. I believe that the % characters are the problem. Does anyone know how I can make a useful .bat file that runs this command?

I am using Windows 7, if this makes a difference. Thanks in advance.

-

I would venture to say you're right about the %, that's one of those characters that needs escaping. Trying replacing the % with %% for every instance.
@Tom: Have you tried .%%%%e? –  Brad Christie Feb 1 '12 at 2:33