ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: dzeek on April 17, 2020, 05:33:08 PM

Title: Copy value of tag into a Windows environment variable
Post by: dzeek on April 17, 2020, 05:33:08 PM
I have a Windows command file script that needs to read the value of a tag from the EXIF data of a file and pass it as an argument when it calls a program.

Is it possible for ExifTool to copy the value of a tag to an environment variable? I could then use the variable in the calling statement.

Thank you
Title: Re: Copy value of tag into a Windows environment variable
Post by: StarGeek on April 17, 2020, 06:01:48 PM
Does it need to be set as an ENV variable?  It seems it would be easier to directly save it to a batch variable.

Using this as the batch file
FOR /F "tokens=*" %%g IN ('exiftool -s3 -Description "y:\!temp\Test4.jpg" ') do (SET VAR=%%g)
echo %VAR%


Output:
PS C:\> exiftool -Description y:\!temp\Test4.jpg
Description                     : New Description
PS C:\> .\test.bat

C:\>FOR /F "tokens=*" %g IN ('exiftool -s3 -Description "y:\!temp\Test4.jpg" ') do (SET VAR=%g )

C:\>(SET VAR=New Description )

C:\>echo New Description
New Description


Otherwise, exiftool doesn't have the ability to directly save to an ENV variable.
Title: Re: Copy value of tag into a Windows environment variable
Post by: dzeek on April 17, 2020, 06:08:14 PM
A DOS batch variable would work. Thank you!