Page 1 of 1

percent signs in command line

Posted: 2009-06-01T23:29:54-07:00
by a1s2d3f4
Does anyone have experience with using convert commands with percent signs in a windows batch file? I searched the forum and found that doubling the percent sign worked for most people but it doesn't work for me.

I have the following command in a batch file:

Code: Select all

CALL convert -rotate 2.958639 -resize 75%% -crop '880x1410+704-25' "c:\Documents and Settings\username\My Documents\IMG_3851.JPG" "c:\temp\1-IMG_3851.jpg"
As you see I doubled the percent sign. When I run this command inside the shell, by typing it out, I don't double the percent sign and convert executes properly.
But running this batch file I get this:


convert: invalid argument for option `75\Documents': -resize.


It's like it is ignoring everything starting with the %% and ending with :

Why is that and is there a work around?

Thanks,
a1

Re: percent signs in command line

Posted: 2009-06-02T00:07:49-07:00
by anthony
See new IM examples section, Windows Usage
http://www.imagemagick.org/Usage/windows/

Re: percent signs in command line

Posted: 2009-06-02T20:54:48-07:00
by a1s2d3f4
Yes, thanks, I did read through it.
I seem to be doing everything correctly, but get this weird error.

Re: percent signs in command line

Posted: 2009-06-03T10:29:30-07:00
by el_supremo
I think what is happening is that the batch process, which initially reads the file, handles the percent and then the CALL does another round of percent processing because if you put four percents (75%%%%) it seems to work properly.
However, an easier way around it is to just omit the CALL - it isn't needed when executing an EXE file.

Pete