I have an unnerving problem with batch scripting... I have these two scripts:
('identify' is part of 'Image Magick' tool suite for image manipulation)
this one works perfectly and prints out the correct image dimensions of all images in the folder:
Code: Select all
@echo off
c:
cd PictureIn
FOR %%a in (*.jpg) do (
For /F "Tokens=*" %%J in ('identify -format "%%h" %%a') Do echo %%J
For /F "Tokens=*" %%I in ('identify -format "%%w" %%a') Do echo %%I
)
@echo on
cd c:\
This one should basically do the same as the above, but store the IM results in a variable inbetween. It doesn' work - seems to be a problem with the variable assignment as it always and only prints out the dimensions of the last image in the folder:
Code: Select all
@echo off
c:
cd PictureIn
FOR %%a in (*.jpg) do (
For /F "Tokens=*" %%J in ('identify -format "%%h" %%a') Do set dw=%%J
For /F "Tokens=*" %%I in ('identify -format "%%w" %%a') Do set dh=%%I
echo %dw%x%dh%
)
@echo on
cd c:\
Any help / ideas / suggestions would be appreciated, I tried about _everything_, resetting the variables first thing in the loop, putting double/single/non % all over the place, putting " instead of ' and vice versa... with funny results, but none that worked.
Thanks,
Jo
PS I'm on win XP