ExifTool Forum

ExifTool => Newbies => Topic started by: EdMcr on April 17, 2025, 08:19:46 AM

Title: Subtract an hour from all times on Windows
Post by: EdMcr on April 17, 2025, 08:19:46 AM
Hi,
This looks like a great tool but I seem unable to get it to work succesfully. I have a folder with images in the wrong timezone so want to shift them to the right time zone.

After reading the docs and the forum, I suspect I want to modify the AllDates Tag but the tool seems to error both on the option I provide as well as the path?

Could someone point me to the right piece of documentation?


'.\exiftool(-k).exe' "-AllDates-=0:0:0 1:0:32" C:\Users\edgar\photos\2025-04-17\*.jpg

At line:1 char:22
+ '.\exiftool(-k).exe' "-AllDates-=0:0:0 1:0:32" C:\Users\edgar\photos\ ...
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token '"-AllDates-=0:0:0 1:0:32"' in expression or statement.
At line:1 char:48
+ ... exe' "-AllDates-=0:0:0 1:0:32" C:\Users\edgar\photos\2025-04-17\*.jpg
+                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token 'C:\Users\edgar\photos\2025-04-17\*.jpg' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken
Thanks

Title: Re: Subtract an hour from all times on Windows
Post by: StarGeek on April 17, 2025, 10:38:25 AM
Use CMD, not PowerShell. PS breaks common exiftool commands that work perfectly well in CMD and on Mac/Linux. See this post (https://exiftool.org/forum/index.php?msg=80581) for an example.
Title: Re: Subtract an hour from all times on Windows
Post by: FrankB on April 17, 2025, 11:50:07 AM
Quote from: StarGeek on April 17, 2025, 10:38:25 AMUse CMD, not PowerShell. PS breaks common exiftool commands that work perfectly well in CMD and on Mac/Linux. See this post (https://exiftool.org/forum/index.php?msg=80581) for an example.

In this case it will not work in CMD either. Dont put single quotes around .\exiftool(-k).exe.


C:\temp>'exiftool.exe' "-AllDates-=0:0:0 1:0:32" *.jpg
''exiftool.exe'' is not recognized as an internal or external command,
operable program or batch file.

C:\temp>exiftool.exe "-AllDates-=0:0:0 1:0:32" *.jpg
    2 image files updated

C:\temp>"exiftool.exe" "-AllDates-=0:0:0 1:0:32" *.jpg
    2 image files updated

Title: Re: Subtract an hour from all times on Windows
Post by: StarGeek on April 17, 2025, 12:09:48 PM
You don't use single quotes in CMD. You're running a program called 'exiftool.exe', not exiftool.exe
C:\>exiftool -time:all --system:all -G1 -a -s y:\!temp\Test4.jpg
[ExifIFD]       DateTimeOriginal                : 2025:04:17 12:00:00

C:\>exiftool -P -overwrite_original "-AllDates-=0:0:0 1:0:32" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -time:all --system:all -G1 -a -s y:\!temp\Test4.jpg
[ExifIFD]       DateTimeOriginal                : 2025:04:17 10:59:28
Title: Re: Subtract an hour from all times on Windows
Post by: FrankB on April 17, 2025, 12:18:04 PM
That is exactly what I was trying to say. The problem with the command EdMcr posted are the single quotes. In this case it is not related to PS or CMD as you suggested. In fact the command works in PS just fine.

ps.jpg
Title: Re: Subtract an hour from all times on Windows
Post by: StarGeek on April 17, 2025, 04:11:14 PM
*sigh*

You're right. Have I mentioned lately how much I hate PowerShell?

Quotes around the program name work fine for CMD, and I think also for Mac and Linux (at least my Unraid can use it). But PS? Nope.
Title: Re: Subtract an hour from all times on Windows
Post by: FrankB on April 17, 2025, 04:41:36 PM
 :)
Title: Re: Subtract an hour from all times on Windows
Post by: EdMcr on April 18, 2025, 02:44:52 AM
Thank you all, using PowerShell instead of CMD and `'` vs `"` was the problem. I appriciate you all taking the time to help me!