vit*_*ira 34
也许它会帮助你:
System.Diagnostics.Process pProcess = new System.Diagnostics.Process();
pProcess.StartInfo.FileName = @"C:\Users\Vitor\ConsoleApplication1.exe";
pProcess.StartInfo.Arguments = "olaa"; //argument
pProcess.StartInfo.UseShellExecute = false;
pProcess.StartInfo.RedirectStandardOutput = true;
pProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
pProcess.StartInfo.CreateNoWindow = true; //not diplay a windows
pProcess.Start();
string output = pProcess.StandardOutput.ReadToEnd(); //The output result
pProcess.WaitForExit();
Run Code Online (Sandbox Code Playgroud)
Mit*_*eat 26
使用System.Diagnostics.Process.Start
可能的重复:如何从C#(WinForms)启动进程
Ram*_*nan 11
嗨,这是调用Notepad.exe的示例控制台应用程序,请查看此处.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace Demo_Console
{
class Program
{
static void Main(string[] args)
{
Process ExternalProcess = new Process();
ExternalProcess.StartInfo.FileName = "Notepad.exe";
ExternalProcess.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
ExternalProcess.Start();
ExternalProcess.WaitForExit();
}
}
}
Run Code Online (Sandbox Code Playgroud)
例如这样:
// run notepad
System.Diagnostics.Process.Start("notepad.exe");
//run calculator
System.Diagnostics.Process.Start("calc.exe");
Run Code Online (Sandbox Code Playgroud)
按照米奇回答中的链接.
| 归档时间: |
|
| 查看次数: |
77907 次 |
| 最近记录: |