Command line too long in batch file for Gimp

3

2

I have run into an issue using GIMP's batch processing.

I have a lot of files spred over a directory tree which need to be processed by a script-fu. I tried to generate a batch file which calls my script for each of theses, but windows complains about the command line being to long.

Here is what my batch file looks like:

@echo off
gimp -d -i -b --verbose "(myscriptName \"path\\to\\file.png\") -b "(myscriptName \"other\\path\to\\file2.png\") [...]

continuing like this for about 360 files more.

Is there way to have gimp process my files without having to call gimp individually for each and all of them?

sum1stolemyname

Posted 2011-04-26T09:30:16.077

Reputation: 271

read what he explained above, so you will see that he has more than 20 + (49 x 362) = 17,758 characters. – kokbira – 2011-04-26T14:35:50.443

Answers

3

Use PowerShell, or bash within Cygwin, or some other more powerful command shell than Windows' default CMD.EXE. These will let you iterate over multiple files on multiple lines (for instance by having the file names in a text file), eliminating this problem.

CarlF

Posted 2011-04-26T09:30:16.077

Reputation: 8 576

1well, you can also give all commands through a file using Windows cmd. just do gimp < parameters.txt . there are another ways with pipe... – kokbira – 2011-04-26T14:31:48.820

@kokbira, fair enough. I haven't worked with Windows batch files in any meaningful way for probably 15 years. – CarlF – 2011-04-26T14:40:48.540

2

If you are using a Windows batch file, use the FOR command.

aphoria

Posted 2011-04-26T09:30:16.077

Reputation: 898