Blog

How to shut down your PC using C#

Posted by Rishikesh Kumar Singh Blogs | How do I Feb 04, 2013
This blog will show you that how to shut down the computer using asp.net C#.

Step-1: Add a namespace

using System.Diagnostics;

Step-2: Write few lines of code on button click:

private void button1_Click(object sender, EventArgs e)
{
    ProcessStartInfo startinfo = new ProcessStartInfo("shutdown.exe", "-s");
    Process.Start(startinfo);
}

COMMENT USING
PREMIUM SPONSORS
Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.
SPONSORED BY
  • MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.