命令行参数参数限制 [英] commandline argument parameter limitation

查看:74
本文介绍了命令行参数参数限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

语言:C#
我必须传递一个巨大的字符串数组(动态构建)作为运行exe的参数。
我正在考虑通过以下两种方法来实现它。但是我没有信心。

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.


  1. 我可以将其创建为一个由空格分隔的字符串。我可以通过Process.Start调用exe。
    因此,正在运行的子进程会考虑该空间并将其保存为字符串数组。
    但是我不确定字符串数组的限制。假设我的字符串数组计数超过10,000

  1. 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

我可以将其创建为一个由特殊符号定界的字符串,该字符串永远不会出现在数据中。我可以用字符串调用exe。正在运行的子进程将其视为单个字符串,在这里我可以使用相同的定界符将其拆分以获取字符串数组。但是,在这里我不确定命令的大小。如果命令行字符串长度很大,可以这样做

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

推荐答案

这取决于操作系统:

请参见在Microsoft支持网站上的命令提示符(Cmd。exe)命令行字符串限制


在运行Microsoft Windows XP或更高版本的计算机上,可以在命令提示符下使用的字符串的最大长度为 8191个字符。在运行Microsoft Windows 2000或Windows NT 4.0的计算机上,可以在命令提示符下使用的字符串的最大长度为 2047个字符

On computers running Microsoft Windows XP or later, the maximum length of the string that you can use at the command prompt is 8191 characters. On computers running Microsoft Windows 2000 or Windows NT 4.0, the maximum length of the string that you can use at the command prompt is 2047 characters.

(重点是我的)

关于字符串数组的大小-如果字符串数组中有数百万个字符串,您主要受可用内存量的限制。

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.

这篇关于命令行参数参数限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆