Windows limitation to the length of command line parameters

program.exe file1 file2 ... file10000 won't work.

Windows have weird limitation to the length of command line parameters. It something between 32683 and 32853 characters. Is there any other way to pass parameters?

11

2 Answers

The most practical solution is to get your vendor to fix the program.

Failing that, it would be possible (though not easy) to hook the GetCommandLine function so that it returns a string of arbitrary length, although this might just cause the program to crash, depending on how it processes the command line.

Q: "Is there any other way to pass parameters"

A: Yes, pass in a single config file. Have your program read the config file to get all the parameters.

For example:

========= Start of "C:\MyConfigFile.txt" ========= file1 file2 ... file10000
=================== End of File ==================

Your command:

program.exe "C:\MyConfigFile.txt"

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like