如何通过倍数论点的ProcessStartInfo? [英] How to pass multiples arguments in processStartInfo?
问题描述
我要运行 C#
code一些 CMD
命令。我跟着一些博客和教程,并得到了答案,但我在点点混乱即我应该如何传递多个参数?
I want to run some cmd
command from c#
code. I followed some blogs and tutorial and got the answer, but i am in little bit confusion i.e How should i pass multiple arguments ?
我用后续code:
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
startInfo.FileName = "cmd.exe";
startInfo.Arguments =
...
什么将是下面的命令行code中的 startInfo.Arguments
价值?
-
makecert -sk服务器-sky交换-pe -n CN =本地主机-ir LOCALMACHINE -is根-ic MyCA.cer -sr LOCALMACHINE -ss我MyAdHocTestCert.cer
的netsh的http添加的sslcert ipport = 127.0.0.1:8085 CERTHASH = 0000000000003ed9cd0c315bbb6dc1c08da5e6的appid = {00112233-4455-6677-8899-AABBCCDDEEFF} clientcertnegotiation =启用
推荐答案
这纯粹是一个字符串:
startInfo.Arguments = "-sk server -sky exchange -pe -n CN=localhost -ir LocalMachine -is Root -ic MyCA.cer -sr LocalMachine -ss My MyAdHocTestCert.cer"
当然,当参数包含空格,您必须使用\\\\,喜欢逃避它们:
Of course, when arguments contain whitespaces you'll have to escape them using \" \", like:
"... -ss \"My MyAdHocTestCert.cer\""
请参阅MSDN这一点。
这篇关于如何通过倍数论点的ProcessStartInfo?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!