日期:2014-05-17 浏览次数:21253 次
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AotuShutdownPC
{
public partial class Shutdown : Form
{
public Shutdown()
{
InitializeComponent();
}
int Delay;
private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
myProcess.StartInfo.FileName = "cmd.exe";
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.RedirectStandardInput = true;
myProcess.StartInfo.RedirectStandardOutput = true;
myProcess.StartInfo.RedirectStandardError = true;
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
if (tabControl1.SelectedIndex == 0)
{
DateTime From = System.DateTime.Now.Date;
DateTime To = dateTimePicker1.Value.Date;
TimeSpan ts =To.Subtract(From);
Delay = ts.Days * 24 * 3600-System.DateTime.Now.Hour * 3600 - System.DateTime.Now.Minute * 60 - System.DateTime.Now.Se