Skip to content

Instantly share code, notes, and snippets.

@dck-jp
Created October 6, 2012 09:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dck-jp/3844522 to your computer and use it in GitHub Desktop.
Save dck-jp/3844522 to your computer and use it in GitHub Desktop.
Reboot/ Shutdown / Suspend on Windows8 By using C#
using System.Diagnostics;
namespace Reboot
{
class Program
{
static void Main(string[] args)
{
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "shutdown.exe";
psi.Arguments = "-r -f -t 0";
psi.CreateNoWindow = true;
Process p = Process.Start(psi);
}
}
}
using System.Diagnostics;
namespace Shutdown
{
class Program
{
static void Main(string[] args)
{
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "shutdown.exe";
psi.Arguments = "-s -f -t 0";
psi.CreateNoWindow = true;
Process p = Process.Start(psi);
}
}
}
using System.Windows.Forms;
namespace Suspend
{
class Program
{
static void Main(string[] args)
{
Application.SetSuspendState(PowerState.Suspend, false, false);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment