0

私は次のコードを使用しました:

static void Main(string[] args)
    {
        ProcessStartInfo perlStartInfo = new ProcessStartInfo(@"C:\strawberry\perl\bin\perl.exe");
        perlStartInfo.Arguments = "c:\\ebm\\parse_ebm_log.pl";
        perlStartInfo.UseShellExecute = false;
        perlStartInfo.RedirectStandardOutput = true;
        perlStartInfo.RedirectStandardError = true;
        perlStartInfo.CreateNoWindow = false;

        Process perl = new Process();
        perl.StartInfo = perlStartInfo;
        perl.Start();
        perl.WaitForExit();
        string output = perl.StandardOutput.ReadToEnd();
    }

perl.MainModule を見ると、この例外があります: MainModule = 'perl.MainModule' throws an exception of type

'System.ComponentModel.Win32Exception' base {System.SystemException} = {"ReadProcessMemory または WriteProcessMemory 要求の一部のみが完了しました"}

x32プロセスでx64を実行できないと言ったときの同じperl.MainModuleの以前の例外により、ターゲットビルドはx64です(そのようなもの)

4

1 に答える 1

1

以下の変更とともに、PATH 環境に perl を追加してみてください (その後、新しい Windows シェルを開きます)。

ProcessStartInfo perlStartInfo = new ProcessStartInfo()
perlStartInfo.FileName= "perl.exe"
perlStartInfo.UseShellExecute = true
于 2013-02-27T18:41:05.987 に答える