Thursday, January 15, 2009

C# - Shutdown or Restart MS Windows

To Shutdown:
System.Diagnostics.Process.Start("ShutDown", "/s");

To restart:
System.Diagnostics.Process.Start("ShutDown", "/r");

List of all possible arguments are as following:

-r Shutdown and restart the computer
-s Shutdown the computer
-t xx Set timeout for shutdown to xx seconds
-a Abort a system shutdown
-f Forces all windows to close
-i Display GUI interface
-l Log off

Share/Bookmark

No comments: