网站首页 博客 C#调用外部exe程序
C#调用外部exe程序
 2017-05-26 15:36:16  管理员  239

例如调用PDFCreator将指定的文件转换为PDF格式

System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = @"D:\PDFCreator.exe";
p.StartInfo.Arguments = @" D:\test.docx -o D:\test.pdf";
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
p.Start();
p.WaitForExit();
string result = p.StandardOutput.ReadToEnd();
p.Kill();


来说两句吧
最新评论