Shutdown , LogOff and Restart Commands :
The following code shows you how you can send shutdown, logoff and restart commands to the computer.
Code
The following code shows you how you can send shutdown, logoff and restart commands to the computer.
Code
using System.Diagnostics;
public void action(string str)
{
switch (str)
{
case "LogOff":
Process.Start("shutdown", "-l -f -t 0");
break;
case "ShutDown":
Process.Start("shutdown", "-s -f -t 0");
break;
case "Restart":
Process.Start("shutdown", "-r -f -t 0");
break;
default:
break;
}
}
0 comments:
Post a Comment