System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);
Application.Exit();


C#定时每天00点00分00秒自动重启软件

private void timerDownCount_Tick(object sender, EventArgs e)
    {
      string dateDiff = null;
      //获取当前时间
      DateTime DateTime1 = DateTime.Now;
      //第二天的00点00分00秒
      DateTime DateTime2 = DateTime.Now.AddDays(1).Date;     
      //计算两个时间相差多少秒
      int sec = (int)DateTime2.Subtract(DateTime1).TotalSeconds;     
      if (sec == 0)
      {
        //延迟1秒执行(为什么要延迟?如果不延迟,重启的瞬间两个时间差依然还是0,就会再次触发重启)
        Thread.Sleep(1000);
        //--------------重启软件 start---------------
        //开启新的实例
        Process.Start(Application.ExecutablePath);
        //关闭当前实例
        Process.GetCurrentProcess().Kill();
        //--------------重启软件 end-----------------     
      }
      if (sec < 0)
      {
        this.timerDownCount.Stop();
      }
      else
      {
        //把2个时间转成TimeSpan,方便计算
        TimeSpan ts1 = new TimeSpan(DateTime1.Ticks);
        TimeSpan ts2 = new TimeSpan(DateTime2.Ticks);
        //时间比较,得出差值
        TimeSpan ts = ts1.Subtract(ts2).Duration();  
        //结果
        dateDiff = ts.Hours.ToString() + "小时" + ts.Minutes.ToString() + "分钟" + ts.Seconds.ToString() + "秒";
        this.labDownCount.Text = dateDiff;
      }
 }