Hello everyone,
I have two questions that I could use your help with:
1) I often assign keywords to my pictures. I do that with the command exiftool -sep "," -keywords+="Keyword 1, Keyword 2"
and then drag the relevant folder or the individual images onto the cmd. It works very well. However, I find it annoying to have to re-enter this command every time I open the cmd. Do any of you know a way to open cmd and already load the command (without executing) so that I don't have to type it in again? That way I could tweak the keywords and then map the images...
2) Some keywords repeat themselves over and over again, e.g. a certain place. What should the batch file look like, onto which I drag the corresponding image using drag-and-drop and the keyword is applied to it? If I just save the command as *.bat as mentioned above, unfortunately nothing happens ...
I would be very happy to receive any help!
Best regards, Matt
Quote from: matt07 on November 10, 2021, 08:20:17 AMDo any of you know a way to open cmd and already load the command (without executing) so that I don't have to type it in again? That way I could tweak the keywords and then map the images...
I'm assuming Windows because you mention CMD. But no, I've never heard of anything like that.
You might look into a text expander type program. If you watch this gif (https://i.imgur.com/safVJoA.gif), you can see where I just type
et and it automatically gets replaced by the start of my basic exiftool command,
exiftool -g1 -a -sQuote2) Some keywords repeat themselves over and over again, e.g. a certain place. What should the batch file look like, onto which I drag the corresponding image using drag-and-drop and the keyword is applied to it? If I just save the command as *.bat as mentioned above, unfortunately nothing happens ...
You need to let Windows know about the files you're dragging and dropping. In this case you probably want to use
%*, e.g.
exiftool -sep "," -keywords+="Keyword 1, Keyword 2" %*. See this old page (via Archive.org) (https://web.archive.org/web/20180120021145/http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true) for some details. Or search on Windows batch parameters (https://www.google.com/search?q=Windows+batch+parameters). The Archive.org page was the simplest I could find in a hurry.
Quote from: matt07 on November 10, 2021, 08:20:17 AM
...Do any of you know a way to open cmd and already load the command (without executing) so that I don't have to type it in again? That way I could tweak the keywords and then map the images...
Here's a BAT file that allows you to enter keywords and then execute your command:
SET /P Keyword1="Enter Keyword 1: "
SET /P Keyword2="Enter Keyword 2: "
SET Command=exiftool -sep "," -keywords+="%Keyword1%, %Keyword2%"
START "" /b %Command% %1
PAUSEDrag and drop a file or folder onto the BAT file.
Quote from: matt07 on November 10, 2021, 08:20:17 AM
...2) Some keywords repeat themselves over and over again, e.g. a certain place. What should the batch file look like, onto which I drag the corresponding image using drag-and-drop and the keyword is applied to it?
To avoid duplicating existing keywords, try this BAT file:
SET /P Keyword1="Enter Keyword 1: "
SET /P Keyword2="Enter Keyword 2: "
SET Command=exiftool -if "$Keywords!~/%Keyword1%/" -keywords+="%Keyword1%" -execute -if "$Keywords!~/%Keyword2%/" -keywords+="%Keyword2%" -common_args -sep "," %1
START "" /b %Command% %1
PAUSE
This would be a faster way to avoid duplicates:
SET /P Keyword1="Enter Keyword 1: "
SET /P Keyword2="Enter Keyword 2: "
SET Command=exiftool -keywords-="%Keyword1%" -keywords+="%Keyword1%" -keywords-="%Keyword2%" -keywords+="%Keyword2%"
START "" /b %Command% %1
PAUSE
FAQ 17 (https://exiftool.org/faq.html#Q17) explains this technique.
- Phil
This is great to know! I had no idea you could drag and drop folders onto a CMD window and it would act on each of the files in the folder. Wow!
That's great! Your suggestions work really well. Thanks for the great ideas! :)