Using date formatting in a batch file

Started by lclarke522, July 28, 2014, 10:59:15 AM

Previous topic - Next topic

lclarke522

Hello! I am trying to execute the following (which works fine from the command line) in a batch file:

exiftool -d %Y-%m%%-c.%%e "-testname<$createdate" *.jpg

I thought I'd need to escape the % with another % sign, but when I use this command in a batch file:

exiftool -d %%Y-%%m%%-c.%%e "-testname<$createdate" *.jpg

I get this result: %Y-%m-106.jpg

I am looking to get: 2014-07-106.jpg

Any help would be appreciated!

Phil Harvey

You need to double all of the %'s:

exiftool -d %%Y-%%m%%%%-c.%%%%e "-testname<$createdate" -ext jpg .

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lclarke522

Oh, thank you!

I had tried at one point changing the %% to %%% but it didn't help. I see why now.

Thanks for your help, and thanks for your great software. I've been nerding out on it all week.