ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Harald on March 09, 2017, 10:23:59 AM

Title: Date formatting not working on Windows batch file
Post by: Harald on March 09, 2017, 10:23:59 AM
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.
Title: Re: Date formatting not working on Windows batch file
Post by: Phil Harvey on March 09, 2017, 10:51:53 AM
"%" characters need to be doubled in windows .bat file commands
Title: Re: Date formatting not working on Windows batch file
Post by: Harald on March 09, 2017, 12:39:49 PM
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.