如何使用C#.Net运行PERL脚本 [英] How to run a PERL script using C#.Net
问题描述
我需要使用C#.net运行PERL脚本.我尝试了以下接线,但它们无法正常工作.请帮我解决这个问题.这是紧急要求.
I need to run PERL script using C#.net. I tried following cording, but they are not working properly. Please help me to solve this issue. This is urgent requirement.
第一编码
Process proc = new Process();
Process proc = new Process();
proc.StartInfo.FileName ="perl";
proc.StartInfo.FileName = "perl";
proc.StartInfo.Arguments = @"C:\ myPerl.pl";
proc.StartInfo.Arguments = @"C:\myPerl.pl";
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.UseShellExecute = false;
proc.Start();
proc.Start();
proc.WaitForExit();
proc.WaitForExit();
字符串输出= proc.StandardOutput.ReadToEnd();
string output = proc.StandardOutput.ReadToEnd();
第二种编码
System.Diagnostics.Process proc =新的System.Diagnostics.Process();
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName ="cmd";
proc.StartInfo.FileName = "cmd";
proc.StartInfo.Arguments ="perl" + @"C:\ myPerl.pl";
proc.StartInfo.Arguments = "perl " +@"C:\myPerl.pl";
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.UseShellExecute = false;
proc.Start();
proc.Start();
proc.WaitForExit();
proc.WaitForExit();
推荐答案
你好,
谢谢您的发帖!我建议您在Visual C#开发人员中心之一>中发布您的问题. Visual C#论坛> Visual C#General位于此处:
Thank you for your post! I would suggest posting your question in one of the Visual C# Developer Center > Visual C# Forums > Visual C# General located here:
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral /threads
希望这对您有所帮助.
祝你有美好的一天!
Hope this helps you.
Have a great day!
谢谢!
迪内什
第2层应用程序支持
服务器和工具在线运营团队
Thanks!
Dinesh
Tier 2 Application Support
Server and Tools Online Operations Team
这篇关于如何使用C#.Net运行PERL脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!