Reputation: 1803
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.
Upvotes: 6
Views: 2889
Reputation: 36654
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
Upvotes: 1
Reputation: 125688
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
Upvotes: 12
Reputation: 53366
The commandline is limited by the OS to 2047 characters.
If you want to use more data, you can use a file.
Upvotes: 8