C# 定时关机小程序
1.打开VS2019,创建界面和按钮
2. 代码如下:
private void button1_Click(object sender, EventArgs e)
{
downpc(txttime.Text);
}
private static void downpc(string time)
{
Process.Start("shutdown", "/s /t "+time);
}
private void button2_Click(object sender, EventArgs e)
{
Process.Start("shutdown", "-a");
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void LinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("https://www.cnblogs.com/pingg2019/");
}