将命令行参数传递给将要启动的进程

时间:2017-12-11 05:46:17

标签: c# cmd process command prompt

我在c#中以管理员身份启动cmd.exe。我想执行一个将重建性能计数器的CMD命令(“ lodctr /R ”)。

// run cmd to build perfomance counter
        string path = @"C:\Windows\System32\cmd.exe";
        Process proc = new Process();

        proc.StartInfo.FileName = path;
        proc.StartInfo.UseShellExecute = true;
        proc.StartInfo.CreateNoWindow = false;
        proc.StartInfo.RedirectStandardOutput = false;
        proc.StartInfo.Verb = "runas";
        //proc.StartInfo.Arguments = 
        proc.Start();
        proc.WaitForExit();

我如何以编程方式执行此cmd命令? StartInfo.Argumments如何工作???

This picture explain how ("lodctr /R") rebuild performance counter.

0 个答案:

没有答案