***System.Diagnostics.Process调用exe之后怎么取得exe的返回值? 
我写的代码如下:
Process pcs = new Process();
                pcs.StartInfo.UseShellExecute = false;
                pcs.StartInfo.RedirectStandardError = true;               
                pcs.StartInfo.FileName = "OBCSETUPSDK\\ObcSetupSDK.exe";
                pcs.StartInfo.Arguments = string.Format(stringBuilder.ToString(),
                    entryLicenseRegistry.ProductID,
                    entryLicenseRegistry.RegistryNo,
                    entryLicenseRegistry.SetupKey,
                    Environment.CurrentDirectory);
                pcs.StartInfo.RedirectStandardOutput = true;
                pcs.Start();
                pcs.WaitForExit();

解决方案 »

  1.   

    string output = pcs.StandardOutput.ReadToEnd();
     
      
    *****************************************************************************
    欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html
      

  2.   

    取不出来值,为空。我把整个代码发上去请大家帮忙看看。
    Process pcs = new Process();
                    pcs.StartInfo.UseShellExecute = false;
                    pcs.StartInfo.RedirectStandardError = true;
                    pcs.StartInfo.RedirectStandardOutput = true;
                    pcs.StartInfo.FileName = "OBCSETUPSDK\\ObcSetupSDK.exe";
                    pcs.StartInfo.Arguments = string.Format(stringBuilder.ToString(),
                        entryLicenseRegistry.ProductID,
                        entryLicenseRegistry.RegistryNo,
                        entryLicenseRegistry.SetupKey,
                        Environment.CurrentDirectory);
                    pcs.StartInfo.RedirectStandardOutput = true;
                    pcs.Start();
                    pcs.WaitForExit();
                    //pcs.e
                    StreamReader srd = pcs.StandardOutput;
                    while (srd.Peek() > -1)
                    {
                        int result = srd.Read();
                    }