C#实现在程序中启动另外一个程序
ProcessStartInfo info = new ProcessStartInfo(); info.FileName = "notepad++.exe";//要启动的程序外部名称 info.Arguments = "1009.txt";//设置外部程序的启动参数 info.WorkingDirectory = @"D:\Users\Desktop"; Process pro;//申明一个程序类 try { pro = Process.Start(info); } catch(System.ComponentModel.WarningException e) { Console.WriteLine("系統找不到指定的程序文件"+e.Message); }
注意:需要添加以下命名空间
using System.Diagnostics;