110,569
社区成员
发帖
与我相关
我的任务
分享
protected override void OnStart(string[] args)
{
string path = ConfigurationManager.AppSettings.Get("startPath");
string waitSec = ConfigurationManager.AppSettings.Get("waitSec");
string name = ConfigurationManager.AppSettings.Get("name");
string delayPath = path + "delay.bat";
string autoRun = "@echo off\r\nping.exe 127.0.0.1 -n " + waitSec
+ " > nul \r\nstart " + path + name;
File.WriteAllText(delayPath, autoRun);
System.Diagnostics.Process p = System.Diagnostics.Process.Start(delayPath);
}