网站首页 博客 C#调用外部exe程序
例如调用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();