I use version 13.19 for windows 11. I have been using it and stumbled upon
Output from Powershell on Windows 11
PS V:\Bilder> exiftool -DateTimeCreated -city -sub-location 2025\2025-02-07
======== 2025/2025-02-07/Ulm, Innere-Wall-Strasse, Schubart-Gymnasium mit Sternwarte 2025-02-07_2318.jpg
Date/Time Created : 2025:02:07 13:22:38+01:00
City : Ulm
Sub-location : Innere-Wall-Strasse
1 directories scanned
1 image files read
Comment: the tags IPTC:City, IPTC:Sub-location and DateTimeCreated exist
PS V:\Bilder> exiftool -if "defined $City" -DateTimeCreated -city -sub-location 2025\2025-02-07
1 directories scanned
1 files failed condition
0 image files read
In my humble opinion this should give the same output, since the Tag City exists
PS V:\Bilder> exiftool -if "defined $IPTC:City" -DateTimeCreated -city -sub-location 2025\2025-02-07
1 directories scanned
1 files failed condition
0 image files read
The same: In my humble opinion this should give the same output, since the Tag City exists
PS V:\Bilder> exiftool -if "not defined $IPTC:City" -DateTimeCreated -IPTC:city -sub-location 2025\2025-02-07
======== 2025/2025-02-07/Ulm, Innere-Wall-Strasse, Schubart-Gymnasium mit Sternwarte 2025-02-07_2318.jpg
Date/Time Created : 2025:02:07 13:22:38+01:00
City : Ulm
Sub-location : Innere-Wall-Strasse
1 directories scanned
1 image files read
This is most crazy: If I test for the non-Existence of an existing tag, it is shown.
Somehow this defies my understanding of boolean logic.
Yet another observation: Testing for the existence of a tag containing a hyphen does not work at all:
-if "defined $IPTC:Sub-location" seems to not work.
It would be nice if someone could help me sorting things out.
Thanks
Othmar
Don't use PowerShell. Use CMD. The quoting rules for PS are different than every other command line and what works on CMD with double quotes or Mac/Linux with single quotes sometimes doesn't work either way on PS. See this post (https://exiftool.org/forum/index.php?msg=80581).
Thanks for clarifying this