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

  • 相关阅读:
    DOM操作创建表格
    基于insertBefore函数编写insertAfter函数
    兼容浏览器将NodeList对象转换为数组
    创建对象
    对象属性
    常用命令
    play framework
    Intellij Idea 15 注册方法
    eclipse 背景色调整,设置成护眼色(豆沙绿)
    查看Eclipse版本号,及各个版本区别
  • 原文地址:https://www.cnblogs.com/doosmile/p/2726468.html
Copyright © 2011-2022 走看看