public void sp(string pr, string arg)
{
var p = new System.Diagnostics.Process();
switch(pr)
{
case "taskkill":
p.StartInfo.FileName = "taskkill.exe";
p.StartInfo.Arguments = arg;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
break;
case "edevice":
p.StartInfo.FileName = "pnputil.exe";
p.StartInfo.Arguments = "/enable-device" + " \"" + arg + "\"";
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
break;
case "ddevice":
p.StartInfo.FileName = "pnputil.exe";
p.StartInfo.Arguments = "/disable-device" + " \"" + arg + "\"";
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
break;
case "mine":
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.Arguments = "/c echo Lan";
p.StartInfo.UseShellExecute = true;
p.StartInfo.CreateNoWindow = false;
break;
}
try
{
if(p.Start())
{
p.WaitForExit();
p = null;
}
}
catch(Exception ex)
{
richTextBox1.Text = ex.Message;
}
}