I'm trying to get the dimensions width/height from a webp image, using exiftool via a batch file and saving those values as variables. I can get the bat file to output the dimensions (in this example it outputs "400x222" in the exiftool window), however I'm not too sure how to redirect those values sucessfully back inside the bat file console window as variables.
Below code gives me what I want, but in the exiftool window:
@echo off
setlocal EnableDelayedExpansion
echo =============== WEBP EXIF ===============
echo.
for %%f in ("C:\ffmpegConvert\*.webp") do (
exiftool -k -s -s -s -ImageSize %%f
)
endlocal
pause
exit
Below is what I tried, but I'm not able to echo back those values in my initial bat file console window (I get "echo is off, once for each failed echo")
@echo off
setlocal EnableDelayedExpansion
echo =============== WEBP EXIF ===============
echo.
for %%f in ("C:\ffmpegConvert\*.webp") do (
for /f "tokens=1,2 delims=x" %%a in ('exiftool -s -s -s -ImageSize %%f') do (
set sW=%%a
set sH=%%b
)
@echo !sW! >CON:
@echo !sH! >CON:
)
endlocal
pause
exit