# Command line too long in batch file for Gimp

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?

-
read what he explained above, so you will see that he has more than 20 + (49 x 362) = 17,758 characters. –  kokbira Apr 26 '11 at 14:35

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.

-
well, you can also give all commands through a file using Windows cmd. just do gimp < parameters.txt . there are another ways with pipe... –  kokbira Apr 26 '11 at 14:31
@kokbira, fair enough. I haven't worked with Windows batch files in any meaningful way for probably 15 years. –  CarlF Apr 26 '11 at 14:40

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

-