在传递很长的文件路径时,我的参数被截断了。我需要启动一个程序并通过命令参数传递所有内容 - 有时它只是截断命令。它在全局范围内执行此操作 - 因此这不仅是每个参数的问题,而且是整个参数的问题。
编辑: 正如 monkey_p 所说,问题可能是命令行长度的限制。问题是:如何绕过它? (更改工作目录是行不通的,因为文件可能存在于不同的位置)。
最佳答案
我不确定您的问题是什么,但命令行有限制。同样的限制对于 Process.Start(command,args) 也有效
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.
关于C# Process.Start 参数被截断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1200789/