Maximum length of command line arguments passed to Delphi console application
Is there a maximum limit how long strings can be passed to开发者_开发技巧 Delphi console application? I am thinking of passing in a lots of JSON data. I would read the data in with ParamStr(x) function.
The max length for CMD.EXE is 8192 characters. This would be the max amount receivable by a Delphi console app because of a limitation in CMD.EXE itself.
The max command length for CreateProcess is 32767 characters. This is due to the UNICODE_STRING structure.
ShellExecute/EX is limited to the INTERNET_MAX_URL_LENGTH, which as Gamecat mentioned is 2047 characters, unless you're running on Win95; there the limit is only MAX_PATH.
For more info, see Raymond Chen's blog post
The commandline is limited by the OS to 2047 characters.
If you want to use more data, you can use a file.
For 'lots of data', using ParamStr could be too limited. Have you considered to use an (anonymous) pipe? Here is a starting point:
Start two processes and connect them with a pipe in Delphi
精彩评论