C#调用CMD命令

来源:互联网 发布:董方卓 知乎 编辑:程序博客网 时间:2024/05/22 02:30
  Process process = new Process            {                StartInfo = { FileName = "cmd.exe", UseShellExecute = false, RedirectStandardInput = true,                                                                                RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true }            };            process.Start();            process.StandardInput.WriteLine("mstsc /v:101.112.119.156 /f");            process.Close();
如果想使用其他命令只需要替换WriteLine中的字符串即可。
原创粉丝点击