Blog

How to shut down your PC using C#

Feb 04, 2013 Blogs | How do I
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);
}

Rishikesh Kumar Singh

I am a .Net developer who is very passionate about work. Have 2+  years hands on  experience in various .Net technologies. Presently i am working as a Software Developer in Aria Telecom Sol ...

  • 295rank
  • 102K readers
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.

Latest Blogs