Thursday, March 18, 2010

Many applications in any language needs basic shutdown, restart, logoff functionality in it. I have also created some applications which needs shutdown or restart or logoff commands in C# programming language, but it tooks a long time to find a small code to do the trick !

So now I'm providing the smallest code to perform these system operations to save your precious time :-

To Shutdown - System.Diagnostics.Process.Start("Shutdown", "/s /t 30");

To Restart - System.Diagnostics.Process.Start("Shutdown", "/s /t 30");

To Logoff - System.Diagnostics.Process.Start("Shutdown", "/s /t 30");

In the above three code snips 30 is the time in seconds, you can increase and decrease it according to your application !

Enjoy !

Download Demo Application
Download DemoScr VS2008 project

1 comments:

A. S. M. SADIQUL ISLAM said...

Nice

Post a Comment