zoukankan      html  css  js  c++  java
  • c# 执行应用程序实例

            public static void DoRAR(string rarFile, string toRarDirecotry, string RARProgramFilePath)
            {
                string arguments = @"a -m0 -ep1 ""{0}"" ""{1}""";
                arguments = string.Format(
                    arguments,
                    rarFile,
                    toRarDirecotry
                );

                var proc = Process.Start(new ProcessStartInfo
                {
                    FileName = RARProgramFilePath,
                    Arguments = arguments,
                    UseShellExecute = false,
                    RedirectStandardOutput = true,
                    RedirectStandardError = true,
                    RedirectStandardInput = true
                }
                );
                proc.WaitForExit();

                if (proc.ExitCode != 0)
                {
                    throw new Exception("Run WinRAR RAR Command Failed!, Exit Code: " + proc.ExitCode +
                        ", Details StandardOuput: " + proc.StandardOutput.ReadToEnd() +
                        ",StandardError" + proc.StandardError.ReadToEnd() +
                        ",StandardInput" + proc.StandardInput +
                        ",Site" + proc.Site);
                }
            }

  • 相关阅读:
    HLG 1522 子序列的和【队列的应用】
    POJ 3273 Monthly Expense【二分】
    HDU 4004 The Frog's Games 【二分】
    POJ 2001 Shortest Prefixes【第一棵字典树】
    POJ 2823 Sliding Window【单调对列经典题目】
    HDU 1969 Pie 【二分】
    POJ 3125 Printer Queue【暴力模拟】
    POJ 3250 Bad Hair Day【单调栈】
    字典树【模板】
    验证码 Code
  • 原文地址:https://www.cnblogs.com/doosmile/p/2726468.html
Copyright © 2011-2022 走看看