ExifTool Forum

ExifTool => Newbies => Topic started by: johnbieber1993 on October 13, 2021, 12:48:15 PM

Title: How to execute multiple commands in one line
Post by: johnbieber1993 on October 13, 2021, 12:48:15 PM
Is this even possible? I apologize in advance for the noob question. I really suck at this but I'm trying my best to familiarize myself with command prompt.

For example, I want to execute six commands in a single go. The commands are:

exiftool -City=Paris "C:\Users\JohnBieber\Images"
exiftool -CountryCode=FRA "C:\Users\JohnBieber\Images"
exiftool -Location="Rue de Marseille" "C:\Users\JohnBieber\Images"
exiftool -Subject="Window Repair, Door Installation, Floor Maintenance" "C:\Users\JohnBieber\Images"
exiftool -GPSLatitude=48.87172395889533 "C:\Users\JohnBieber\Images"
exiftool -GPSLatitude=2.3635048980532263 "C:\Users\JohnBieber\Images"

Is it possible to execute them all in one command? Thank you to whoever will answer.
Title: Re: How to execute multiple commands in one line
Post by: StarGeek on October 13, 2021, 01:39:31 PM
Just put them all in one command, as per Note #1 under the -TAG[+-^]=[VALUE] option (https://exiftool.org/exiftool_pod.html#TAG---VALUE).  Also see the Writing Examples (https://exiftool.org/exiftool_pod.html#exiftool--keywords-EXIF--keywords-editor-dst.jpg).

Though understand your commmand for Subject will replace any existing keywords and will make one single long keyword of
Window Repair, Door Installation, Floor Maintenance

If you want these to be separate keywords and you don't want to remove any existing keywords, you add them individually using +=
-Subject+="Window Repair" -Subject+="Door Installation" -Subject+="Floor Maintenance"
or use the -sep option (https://exiftool.org/exiftool_pod.html#sep-STR--separator)
-Subject+="Window Repair, Door Installation, Floor Maintenance" -sep ", "
Also take note that exiftool will not remove duplicates if you add the same keyword more than once.  See FAQ #17 (https://exiftool.org/faq.html#Q17) for details on working with list type tags.
Title: Re: How to execute multiple commands in one line
Post by: johnbieber1993 on October 13, 2021, 08:04:51 PM
Hello. Thank you so much for your help. I almost messed up had you not pointed that out. Also - am I right for using the command -Subject= to remove the duplicates? Just want to be sure.
Title: Re: How to execute multiple commands in one line
Post by: Phil Harvey on October 13, 2021, 09:21:08 PM
Hi John,

Quote from: johnbieber1993 on October 13, 2021, 08:04:51 PM
am I right for using the command -Subject= to remove the duplicates?

Yes.

- Phil
Title: Re: How to execute multiple commands in one line
Post by: StarGeek on October 13, 2021, 09:55:31 PM
Using
-Subject=
by itself removes all the keywords.  The FAQ link above tells you how to prevent duplicates when you add new keywords.  The other option would be to run a second command using the NoDups helper function (https://exiftool.org//exiftool_pod.html#Helper-functions).  An example command for that is at that link.