如何在C#中将多个参数传递给新创建的进程?
我应该在执行程序时使用哪个类(Process或ProcessStartInfo或MyProcess),条件是将多个参数传递给新创建/执行的进程?
因为我有相同的任务的等效(Borland)C++代码,如下所示:
spawnv(P_NOWAITO,Registry->ReadString("Downloader").c_str(),arglist);
Run Code Online (Sandbox Code Playgroud)
其中arglist是char指针数组
Registry->ReadString("Downloader").c_str(),是要执行的程序.
Jos*_*osh 27
为了传递多个命令行参数,您应该用空格分隔每个参数,并在参数本身包含空格的情况下用引号括起来.
string[] args = { "first", "second", "\"third arg\"" };
Process.Start("blah.exe", String.Join(" ", args));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
26842 次 |
| 最近记录: |