Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 928
iluwatar Avatar asked Mar 04 '11 13:03

iluwatar


2 Answers

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

like image 80
Ken White Avatar answered Sep 21 '22 12:09

Ken White


The commandline is limited by the OS to 2047 characters.

If you want to use more data, you can use a file.

like image 36
Toon Krijthe Avatar answered Sep 25 '22 12:09

Toon Krijthe