How to shut down your PC using C#

By Rishikesh Kumar Singh Feb 04 2013
This blog will show you that how to shut down the computer using C#.
    • Like
    • Love It
    • Awesome
    • Interesting
    • It's Okay
    • Thumbs Down
  • 17.1k
  • 0

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