DOS Script with Wildcards (% error) help.

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
redkahuna
Posts: 9
Joined: 2012-03-01T00:32:56-07:00
Authentication code: 8675308

DOS Script with Wildcards (% error) help.

Post by redkahuna »

version: ImageMagick-6.7.5-7-Q16-windows-dll.exe

Can anyone help me out with this DOS script

---
@echo off
for %%a in ("*.png") do call convert %%a -transparent none -resize 50% PNG32:%%a
---

I get error: @error/covert.c/ConvertImageCommand/2353
because the 50% resize argument has a "%" in it.

Is there a way to get around this?
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: DOS Script with Wildcards (% error) help.

Post by el_supremo »

You have to double the percent - 50%%

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.
redkahuna
Posts: 9
Joined: 2012-03-01T00:32:56-07:00
Authentication code: 8675308

Re: DOS Script with Wildcards (% error) help.

Post by redkahuna »

Hi Pete,
Somehow DOS changes the argument when adding the double %% for the percent argument for convert command and just fails?

Code: Select all

@echo off
for %%a in ("*.png") do call convert %%a -transparent none -resize 50%% PNG32:%%a
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: DOS Script with Wildcards (% error) help.

Post by el_supremo »

It would appear that it is the "call' that is causing the problem although I don't know why. Try this:

Code: Select all

for %%a in ("*.png") do convert %%a -transparent none -resize 50%% PNG32:%%a
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.
redkahuna
Posts: 9
Joined: 2012-03-01T00:32:56-07:00
Authentication code: 8675308

Re: DOS Script with Wildcards (% error) help.

Post by redkahuna »

Removing the word "call" worked! Thanks Pete!
Post Reply