percent signs in command line

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
a1s2d3f4

percent signs in command line

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: percent signs in command line

Post by anthony »

See new IM examples section, Windows Usage
http://www.imagemagick.org/Usage/windows/
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
a1s2d3f4

Re: percent signs in command line

Post by a1s2d3f4 »

Yes, thanks, I did read through it.
I seem to be doing everything correctly, but get this weird error.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: percent signs in command line

Post 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
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
Post Reply