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);
}

comments
COMMENT USING
PREMIUM SPONSORS
Nevron Software is a global leader in component based data visualization technology for a diverse range of Microsoft centric platforms. Nevron Data Visualization components are used by many companies, educational and government organizations around the world.
Nevron Chart
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Nevron Chart