다음 코드를 얻으려고 노력 중이므로 C# 프로그램에서 perl 스크립트를 호출 할 수 있습니다. 나는 xp 서비스 팩 3에서 visual stdio 2008을 사용하여 개발 중입니다.ProcessStartInfo에서 perl.exe를 호출 할 수 없습니다.
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();
나는 test_perl.pl이 있는지 확인하고, perl.exe를 notepad.exe로 변경하면 위의 코드가 작동합니다. 그러나 perl.exe를 사용하면 메시지 상자가 비어 있습니다.
왜 이것이 잘못된 것인지 알 수 없습니다. 이유를 알면 도와주세요.
감사
perl.exe를 notepad.exe로 변경하면 파일 경로에 문제가 있다고 생각하지 않습니다. 또한 myusername \ Documents \을 삭제합니다. – alex
... 어쨌든 사용해보십시오. 메모장! = perl. –
마이클, 너 좋다! 감사! 지금 일하고있다. 하지만 거기에 여분의 이유는 무엇입니까? – alex