Language: C#
I have to pass a huge string array (built dynamically) as an argument to run an exe.
I am thinking of acheiving it by the below 2 ways. But I am not feeling confident.
-
I can create it as one string delimited by spaces. I can invoke the exe through Process.Start.
Hence the running child process considers the space and holds as a string array.
However I am unsure about the string array limitation. Suppose if my string array count exceeds more than 10,000 -
I can create it as one string delimited by a special symbol, which never fall in data. I can invoke the exe with the string. The running child process considers it as one single string, where i can split it with the same delimiter to get the string array back. However, here i am unsure about the command size. Will that do, if the command line string length is large
Can anyone help me in letting me know the parameter size limitations
It depends on the OS:
See Command prompt (Cmd. exe) command-line string limitation on the Microsoft Support site.
(emphasis mine)
In regards to the size of a string array – if you have many millions of strings in a string array – you are mostly limited by the amount of memory available.