Page 1 of 1

DOS Script with Wildcards (% error) help.

Posted: 2012-03-01T00:40:24-07:00
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?

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

Posted: 2012-03-01T08:48:09-07:00
by el_supremo
You have to double the percent - 50%%

Pete

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

Posted: 2012-03-01T09:04:09-07:00
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

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

Posted: 2012-03-01T13:33:40-07:00
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

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

Posted: 2012-03-01T16:32:42-07:00
by redkahuna
Removing the word "call" worked! Thanks Pete!