c# tips: execute windows shutdown ,restart ,logof command in c#

i make c# function for these command

private void execute_command(String Comande)
{
if (Comande.CompareTo("shutdown") == 1)
{
System.Diagnostics.Process.Start("shutdown", "-s");
}
else if (Comande.CompareTo("restart") == 1)
{
System.Diagnostics.Process.Start("shutdown", "-r");
}
else if (Comande.CompareTo("logoff") == 1)
{
System.Diagnostics.Process.Start("shutdown", "-l");
}
else if (Comande.CompareTo("abort") == 1)
{
System.Diagnostics.Process.Start("shutdown", "-a");
}
}

Advertisements

About kishor datta gupta

Graduate Research Assistant at University of Memphis Software Engineer at Silicon Orchard LTD. Former Research Assistant at Lamar University Former Software Engineer at Samsung R&D Institute Bangladesh Studies Ph.D. Computer Science at University of Memphis Studied Masters of Science in Computer Sciences at Lamar University Studied BSC in CSE at Khulna University of Engineering and Technology Studied HSC (completed) at Chittagang college 04-06 Studied High school at ST. Placid's High School'04 Studied Junior Secondary School at Saint Mary's School Lives in Memphis, Tennessee
This entry was posted in C#, Winform app and tagged , , , , , . Bookmark the permalink.

One Response to c# tips: execute windows shutdown ,restart ,logof command in c#

  1. tanvir says:

    sir plz can u send the source code of this project to me
    becoz i want same project for submission my email id is “tanvirs47@gmail.com”

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s