Page 1 of 1

ARGH!! Command works but not in batch file?!!

Posted: 2013-09-06T07:35:16-07:00
by Misty1
I'm running a basic convert command, which works perfectly when I type/copy it into DOS;

convert c:\Photo_Uploads\camera\*.jpg -resize 20% -set filename:fname '%t_tn' +adjoin z:\%[filename:fname].jpg

All it does is resize the jpg's and move them to another folder. If I use this command in a batch file, it fails with the following error;

convert.exe: invalid argument for option `-resize': 20fname @ error/convert.c/ConvertImageCommand/2451.

So it looks like it doesn't even call the whole command before failing. I can't figure it out and am at my wits end. If anyone can suggested anything I'd be in their debt!!

Re: ARGH!! Command works but not in batch file?!!

Posted: 2013-09-06T07:38:39-07:00
by Bonzo
You need to escape the % in a batch file usualy with another %.

Check out this page

You probably need to change '%t_tn' to "%%t_tn" as Windows needs " and not '

Re: ARGH!! Command works but not in batch file?!!

Posted: 2013-09-06T07:46:10-07:00
by Misty1
Thanks for your help, though if I double the % signs;

convert c:\Photo_Uploads\camera\*.jpg -resize 20% -set filename:fname '%%t_tn' +adjoin z:\%%[filename:fname].jpg

although it takes longer to run, it fails with the same error message;

convert.exe: invalid argument for option `-resize': 20fname @ error/convert.c/ConvertImageCommand/2451.

Re: ARGH!! Command works but not in batch file?!!

Posted: 2013-09-06T07:47:41-07:00
by Bonzo
What about the 20% :D

Re: ARGH!! Command works but not in batch file?!!

Posted: 2013-09-06T07:51:06-07:00
by Misty1
Heh, I feel like a right tool now!! That worked, thanks a million for your help :D