C#调用Perl脚本
来源:互联网 发布:淘宝月老祠堂卖正品吗 编辑:程序博客网 时间:2024/05/22 17:25
/// <summary> /// Executes a process and waits for it to end. /// </summary> /// <param name="fileName">Full Path of process to execute.</param> /// <param name="arguments">Command Line params of process</param> /// <param name="workingDirectory">Process working directory</param> /// <param name="timeout">Time to wait for process to end</param> /// <param name="stdOutput">Redirected standard output of process</param> /// <returns>Process exit code</returns> public static int ExecuteProcess(string fileName, string arguments, string workingDirectory, int timeout, out string stdOutput) { ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName = fileName; psi.Arguments = arguments; psi.WorkingDirectory = workingDirectory; psi.WindowStyle = ProcessWindowStyle.Hidden; psi.UseShellExecute = false; psi.RedirectStandardOutput = true; psi.CreateNoWindow = true; using (Process process = Process.Start(psi)) { stdOutput = process.StandardOutput.ReadToEnd(); process.WaitForExit(timeout); return process.ExitCode; } }
调用:
int exitCode = Util.ExecuteProcess("\"C:\\Perl\\bin\\perl.exe\"", " RouteGetter.pl ", "C:\\", 10000, out stdOutput);
ps:
第一个参数是 perl 的path路径,第二个参数是要调用perl文件的全称,第三个参数是被调用perl 文件的路径,第四个参数等待进程延迟时间,最后一个参数是返回的输出流。
- C#调用Perl脚本
- c++ 调用 perl 脚本
- python调用perl脚本
- JAVA程序调用Perl脚本
- JAVA中调用perl脚本!
- i_e_dpi_jt_create.tcl 调用 perl脚本【BI】
- c#后台调用脚本
- c#调用matlab脚本
- C# 调用 python脚本
- C#调用python脚本
- js脚本调用C#程序
- C# 调用批python 脚本
- 后台C#调用js脚本
- C# 调用 js 脚本例子
- perl 脚本
- perl脚本
- perl脚本调用shell命令后的结果比较总结
- C++ code中调用perl/shll脚本方法
- 高级着色语言HLSL入门
- 注册表全集3
- Google Android Hidden Secret Codes
- CSplitterWnd窗口拆分后如何获得指定窗口的指针
- struts2全面讲解及实例
- C#调用Perl脚本
- Java的native方法
- sigwait()的一些应用
- 测试clang是否支持linux内核模块编译
- AS3处理XML
- 获取系统属性--JAVA编程
- Ajax技术全面讲解
- HDU 1429 胜利大逃亡(续) 状态压缩BFS
- PHP内核介绍及扩展开发指南—基础知识