ROOT Command Line Length

Dear Devs,

I am trying to pass a set of file names to one of my ROOT scripts, and found that there is a maximum limit to the command line arguments that we can pass to ROOT.

e.g. root -l- b -q ‘MyScript.C(“file1,file2 …”)’

I could use wildcards, but when the file names are different it is difficult to use them as well.

Is there a way to increase the length of the command line arguments in ROOT? Please let me know.



what about creating a symbolic link on your filesytem, eg ‘ln -s myverylongfilename.root ashortfilename.root’?


Dear Oliver,

Thanks for the information.
I am using a symbolic link already to shorten the directory path.

The number of files that a user specify is not fixed. Therefore, I need a more generic solution.

Could you please let me know the maximum length of the arguments that the ROOT accepts? This way I can check the length before sending it to the server.



You best solution is that instead of making a shell call with all your files, you should simply create/generate a simple wrapper script listing of you files. I.e. the equivalent of: echo "{" > mywrapper.C echo 'gROOT->ProcessLine(".L MyScript.C"); } >> mywrapper.C echo 'std::vector<std::string> myfiles; >> mywrapper.C echo 'myfiles.push_back(file1);' >> mywrapper.C echo 'myfiles.push_back(file2);' >> mywrapper.C echo 'myfiles.push_back(file3);' >> mywrapper.C echo 'MyScript(myfiles); >> mywrapper.C echo '}' >> mywrapper.C root.exe -q -l -a mywrapper.C
This has the additional advantage that you do no have to deal with a C++ function taking an arbitrary number of arguments.


Hi Philippe,

Yes, this solved my problem. Thank you very much!