@echo off
rem put this in export actions folder of lightroom, together with exiftool.exe
rem watch out: take exiftool(-k).exe and rename it to exiftool.exe
rem if not, you will get a press return prompt at every file treated
rem at export, call it via post peocessing option 
rem this is called once, with
rem parameters full path output filenames (very likely between double quotes)
rem thus loop and shift until no more files
set xtool=%~dp0\exiftool.exe
set logfile=%~dpn0-log.log

if not exist "%xtool%" exit

set fntag=originalfilename

echo Post-Processing Images > "%logfile%"

rem remove quotes in case there are any
set fpname=%~1
if not exist "%fpname%" goto endloop
rem get filename without extension to put in tag
set img=%~n1
echo --- treating file "%fpname%" >> "%logfile%"
set runcmd="%xtool%" -q -overwrite_original -%fntag%=%img% "%fpname%"
echo     calling %runcmd% >> "%logfile%"
call %runcmd%
rem call "%xtool%" -v3 -overwrite_original -%fntag%=%img% "%1"
echo     tag %fntag% set to %img% >> "%logfile%"
goto loop
echo Post-Processing Images done >> "%logfile%"
more "%logfile%"

© Marcel Quintelier.