Copy value of tag into a Windows environment variable

Started by dzeek, April 17, 2020, 05:33:08 PM

Previous topic - Next topic

dzeek

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

StarGeek

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.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

dzeek