怎么实现一点按钮 自动完成命令!
String ip =text1.text;
String path =text2.text;
public string RunDosCommand(string command)
{
Process process = new Process();
process.StartInfo.FileName = "wmic.exe";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = false;
process.Start();
process.StandardInput.WriteLine(command);
process.StandardInput.WriteLine("exit");
return process.StandardOutput.ReadToEnd();
}
private void button2_Click(object sender, EventArgs e)
{
string ip = txtid.Text;
//运行的wmic命令
string.Format( RunDosCommand("/node:'{0}'/user:administrator/password:'' process"),ip);
Console.Read();
}
我就只能写到这个 IP是用户自己打的 意思就是 Button2能 取出进程的状态 输入到TEXT3 里
会的大哥帮个忙 我也是无聊的
------解决方案--------------------
帮顶~回复内容太短了!