ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: ExifRookie on February 03, 2023, 09:57:14 PM

Title: Command line rename runs directly, but fails when it is in a bat file
Post by: ExifRookie on February 03, 2023, 09:57:14 PM
Hello, 

This is probably something simple I am missing, but I am at a loss currently. 

I have a command that works when run from the command line directly -
"C:\Program Files\Hugin\bin\exiftool" "-filename<CreateDate" -d %Y%m%d_%H%M%S%%-c.pano.%%le DJI_0025.JPG -a
But when placed in this bat file, it fails -
REM Rename the output to the date it was captured to help clarify the filename.
"C:\Program Files\Hugin\bin\exiftool" "-filename<CreateDate" -d %Y%m%d_%H%M%S%%-c.pano.%%le DJI_0025.JPG -a
REM This does not work for some reason?
Pause

Here is what happens on the command line -
D:\Photo Location Testing\Rename Test>renameTest2.bat

D:\Photo Location Testing\Rename Test>REM Rename the output to the date it was captured to help clarify the filename.

D:\Photo Location Testing\Rename Test>"C:\Program Files\Hugin\bin\exiftool" "-filename<CreateDate" -d mHS%-c.pano.%le DJI_0025.JPG -a -m
Warning: New file name is empty - DJI_0025.JPG
    0 image files updated
    1 image files unchanged

D:\Photo Location Testing\Rename Test>REM This does not work for some reason?

D:\Photo Location Testing\Rename Test>Pause
Press any key to continue . . .

D:\Photo Location Testing\Rename Test>"C:\Program Files\Hugin\bin\exiftool" "-filename<CreateDate" -d %Y%m%d_%H%M%S%%-c.pano.%%le DJI_0025.JPG -a
Warning: [minor] Possibly incorrect maker notes offsets (fix by 1783?) - DJI_0025.JPG
Warning: [minor] Suspicious MakerNotes offset for tag 0x0025 - DJI_0025.JPG
    1 image files updated

The bat file also fails when run as admin.

I found an old post related to a similar error where Maker Notes Errors (https://exiftool.org/faq.html#Q15) were mentioned, but this does not seem to apply to my case. 

Any pointers for me to look into?

Thank you!

Title: Re: Command line rename runs directly, but fails when it is in a bat file
Post by: StarGeek on February 04, 2023, 02:37:02 AM
See FAQ #27 (https://exiftool.org/faq.html#Q27)