-1
我想運行一個exe文件,如果這個exe文件關閉了,windows服務必須通過檢查是否關閉或者沒有時間間隔來重新啓動這個exe文件。用windows服務連續運行.exe文件
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new Service1()
};
string filename = "C:\\a.exe";
Process.Start(filename);
ServiceBase.Run(ServicesToRun);
}
}
什麼是你的問題? –