Reputation: 75
So, I'm trying to rescale a bunch of images at once with a program called ImageResizer, and the command forfiles
.
But since I have to use quotation marks for both, the command itself, and an argument inside of it, that won't work:
ERROR: Argument/Option invalid- '4x /save @FILE'.
How do I handle those two strings in batch? I found some similar questions, but I didn't get it to work.
Here's my code:
@echo off
cd %~dp0
cd gfx
forfiles /s /m *.png /c "C:\Users\Manu\Desktop\NeuerOrdner\ImageRes.exe /load @FILE /resize auto "XBR 4x" /save @FILE"
pause
Upvotes: 5
Views: 2147
Reputation: 3243
FORFILES recognizes \" as the way of escaping inner ". So try this:
forfiles /s /m *.png /c "C:\Users\Manu\Desktop\NeuerOrdner\ImageRes.exe /load @FILE /resize auto \"XBR 4x\" /save @FILE"
Upvotes: 0
Reputation: 57252
this is a bug in forfiles.And you need to encode quotes with 0x22
you can try like this:
@echo off
setlocal
set "path=%path%;C:\Users\Manu\Desktop\NeuerOrdner\"
cd %~dp0
cd gfx
forfiles /s /m *.png /c "ImageRes.exe ImageRes.exe /load @FILE /resize auto 0x22XBR 4x0x22 /save @FILE"
endlocal
pause
or
@echo off
cd %~dp0
cd gfx
forfiles /s /m *.png /c "C:\Users\Manu\Desktop\NeuerOrdner\ImageRes.exe /load @FILE /resize auto 0x22XBR 4x0x22 /save @FILE"
pause
(additional space after imageres.exe
)
Upvotes: 3