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);
                }
            }

  • 相关阅读:
    爬取校园新闻首页的新闻
    网络爬虫基础练习
    综合练习:词频统计
    免费的论文查重网站
    Hadoop综合大作业
    理解MapReduce
    熟悉常用的HBase操作
    熟悉常用的HDFS操作
    爬虫大作业
    数据结构化与保存
  • 原文地址:https://www.cnblogs.com/doosmile/p/2726468.html
Copyright © 2011-2022 走看看