Mogrify -resize works in cmd.exe but not in .bat file
Posted: 2014-02-18T04:07:07-07:00
If i do it manually with cmd.exe mogrify works a charm.
However, when I run it from a .bat file it fails. I tried some with convert too just in case but no joy. The error code is always The command "mogrify" is missing or not found.
I thought I had found the answer here but as my images are being created and the active directory is where I want it I don't see how that could be the issue.
I have opened a console, cd to the new directory created by the above, copied and pasted one of the below mogrify commands and it works fine.
So I reckon it's either down to a difference between cmd and bat that I'm not aware of or something in imagemagick. Either way I'm new to both so hoping someone can help me.
Code is as follows:
However, when I run it from a .bat file it fails. I tried some with convert too just in case but no joy. The error code is always The command "mogrify" is missing or not found.
I thought I had found the answer here but as my images are being created and the active directory is where I want it I don't see how that could be the issue.
I have opened a console, cd to the new directory created by the above, copied and pasted one of the below mogrify commands and it works fine.
So I reckon it's either down to a difference between cmd and bat that I'm not aware of or something in imagemagick. Either way I'm new to both so hoping someone can help me.
Code is as follows:
Code: Select all
set path=icons %date:~0% %time:~0,2%_%time:~3,2%_%time:~6,2%\
md "%path%"
cd %path%
copy %1 "ios_144x144.png"
copy %1 "android_ldpi.png"
copy %1 "android_mdpi.png"
copy %1 "android_hdpi.png"
copy %1 "android_xhdpi.png"
copy %1 "ios_57x57.png"
copy %1 "ios_72x72.png"
copy %1 "ios_114x114.png"
copy %1 "ios_144x144.png"
pause //Check here to see if dir and images created and that command line is now in %path%. In test runs all is okay as far as here
convert -resize 36x36 android_ldpi.png
mogrify -resize 48x48 android_mdpi.png
mogrify -resize 72x72 android_hdpi.png
mogrify -resize 96x96 android_xhdpi.png
mogrify -resize 114x114 ios_114x114.png
mogrify -resize 144x144 ios_144x144.png
mogrify -resize 72x72 ios_72x72.png
mogrify -resize 57x57 ios_57x57.png
echo Verzeichnis %path% fertig.
pause>nul