Search code examples
gccmakefilecommand-linecommand-line-argumentsgit-bash

Maximum command line length in git bash


It looks like there is a hardwired limit of 8192 (or so) characters which is substantially less than the 32000 which is reported by

getconf ARG_MAX

I am using git bash as a very convenient (because deployed in a controlled mainstream way) method to run GNU make on Windows. The only problem which can sometimes hamper my process is the length of the command line to gcc which due to some unchangeable factors has several dozen up to a hundred -Iinclude_dir parameters. If you think that evading the problem by changing the latter intricacy would be the wiser option, I am all ears for a solution to that.


Solution

  • https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/830473 Command line length limit on Windows is 2047 or 8191, depending on OS version.

    Because of this limitation, many Windows developer tools accept "response files" which are text files containing arguments. GCC supports this too.