发布于 2008-10-27 14:58:40
使用System.Diagnostics.Process.Start()
方法。
请查看this article了解如何使用它。
Process.Start("notepad", "readme.txt");
string winpath = Environment.GetEnvironmentVariable("windir");
string path = System.IO.Path.GetDirectoryName(
System.Windows.Forms.Application.ExecutablePath);
Process.Start(winpath + @"\Microsoft.NET\Framework\v1.0.3705\Installutil.exe",
path + "\\MyService.exe");
发布于 2008-10-27 16:55:16
下面是一些有用的代码片段:
using System.Diagnostics;
// Prepare the process to run
ProcessStartInfo start = new ProcessStartInfo();
// Enter in the command line arguments, everything you would enter after the executable name itself
start.Arguments = arguments;
// Enter the executable to run, including the complete path
start.FileName = ExeName;
// Do you want to show a console window?
start.WindowStyle = ProcessWindowStyle.Hidden;
start.CreateNoWindow = true;
int exitCode;
// Run the external process & wait for it to finish
using (Process proc = Process.Start(start))
{
proc.WaitForExit();
// Retrieve the app's exit code
exitCode = proc.ExitCode;
}
你可以用这些对象做更多的事情,你应该阅读文档:ProcessStartInfo,Process。
发布于 2008-10-27 14:58:36
System.Diagnostics.Process.Start("PathToExe.exe");
https://stackoverflow.com/questions/240171
复制相似问题