C# Process.Start 参数被截断
当传递很长的文件路径时,我的参数被截断。 我需要启动一个程序并通过命令参数传递所有内容 - 有时它只是截断命令。 它是在全局范围内进行的 - 因此这不仅是每个参数的问题,而且是整个参数的问题。
编辑: 正如 monkey_p 所说,问题可能是命令行长度的限制。 问题是:如何绕过它? (更改工作目录是行不通的,因为文件可能存在于不同的位置)。
I've got truncated parameters when passing very long file paths. I need to start a program and pass it everything via command params - sometimes it just truncates the command. It does it globally - so it's not only a problem for each parameter but for whole.
edit:
The problem is probably the limit on the command line length as monkey_p said. The questions is: How to bypass it? (changing working directory won't do becouse files can exist in different locations).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定您的问题是什么,但命令行有限制。 同样的限制对于 Process.Start(command,args) 也有效
I'm not sure what your question is, but there is a limitation on the commandline. This same limitation will be valid for Process.Start(command,args)
这是来自 Microsoft 支持,所以对我没有任何帮助 - 似乎无法增加此限制并且无法以任何其他方式运行它...
我将尝试做的是: 记住每个文件的路径,将它们移动到某个 DIR,然后将 CurrentDirectory 设置为 DIR 运行程序,然后传入文件名,程序结束后将文件移回原来的位置 - 丑陋,丑陋,丑陋,我知道,但似乎没有其他方法......
that is from Microsoft Support, so nothing helpful for me - it seems that this limit cannot be increased and there is no way to run it in any other way...
What I'll try to do is: Remember the path to each file, move them to some DIR and then run program with CurrentDirectory set to DIR and just pass in the file names and after program has ended move the files back to their place - ugly, ugly, ugly, I know, but it seems that there is no other way...