Hello: I am trying to get the following code to work so I can call a perl script from my c# program. I am developing using visual stdio 2008 on xp service pack3.
myProcess = new Process();
ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("perl.exe");
myProcessStartInfo.Arguments = @"C:\Documents and Settings\test_perl.pl";
myProcessStartInfo.UseShellExecute = false;
myProcessStartInfo.RedirectStandardOutput = true;
myProcessStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
myProcessStartInfo.CreateNoWindow = true;
myProcess.StartInfo = myProcessStartInfo;
myProcess.Start();
string output = myProcess.StandardOutput.ReadToEnd();
MessageBox.Show(output);
myProcess.WaitForExit();
I verify the test_perl.pl exists and If I change the perl.exe to notepad.exe, thie above code works. But if I use perl.exe, the message box is empty.
Can't figure out why this is wrong. Please help me if you know why.
Thanks