windows重启命令

发布日期:2013-04-01 14:38:15

shutdown -f -r


using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Runtime.InteropServices;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    [DllImport("user32.dll")]
    public static extern int ExitWindowsEx(int operationFlag, int operationReason);
    protected void btnRestart_Click(object sender, EventArgs e)
    {
        ExitWindowsEx(2, 0);
    }
    protected void btnLogOff_Click(object sender, EventArgs e)
    {
        ExitWindowsEx(0, 0);
    }
    protected void btnForcedLogOff_Click(object sender, EventArgs e)
    {
        ExitWindowsEx(4, 0);
    }
    protected void btnShutDown_Click(object sender, EventArgs e)
    {
        ExitWindowsEx(1, 0);
    }
}