Date formatting not working on Windows batch file

Started by Harald, March 09, 2017, 10:23:59 AM

Previous topic - Next topic

Harald

I have the following statement running well on command prompt, but not so well when run from a .bat file

The command is:
exiftool -m -if "not $usercomment eq 'processed'" "-xmp:description<${xmp:description} - ${xmp:location}, ${xmp:city}, ${xmp:country}; Photographer: ${xmp:creator}; ${exif:createdate}" -d %Y-%m -usercomment='processed' .

But it gets corrupted and in the execution it reads :
exiftool -m -if "not $usercomment eq 'processed'" "-xmp:description<${xmp:description} - ${xmp:location}, ${xmp:city}, ${xmp:country}; Photographer: ${xmp:creator}; ${exif:createdate}" -d m -usercomment='processed' test.jpg

Note the missing "%" in front of the "m" and the missing %Y

here is the image data and output:

INPUT:
Description                     : Long Life puja offered to Lama Zopa Rinpoche by Sera Je Monastery, monks offering the puja.
City                                : Bodhgaya
Country                          : India
Creator                           : Losang Sherab
Create Date                    : 2017:01:02 17:03:25

OUTPUT:
"Long Life puja offered to Lama Zopa Rinpoche by Sera Je Monastery, monks offering the puja. - , Bodhgaya, India; Photographer: Losang Sherab; 2017- m"

Why is that happening? Actually Notepad++ does color these characters in orange. Reason?

Thanks a lot in advance for your help.

Phil Harvey

"%" characters need to be doubled in windows .bat file commands
...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 ($).

Harald

Thanks a lot, Phil. This is probably one of the many things I will never understand where they come from. Which is why the Internet is so amazing. Thanks again.