首页 > 其他 > 详细

c# 解压文件

时间:2014-05-07 20:36:10      阅读:408      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
  public bool UnRAR(string destPath, string rarfilePath)
        {
            try
            {
                // destPath = @"E:\youxiaodi\temp"; //目标位置
                // rarfilePath = @"E:\youxiaodi\temp\gif.rar"; //被解压文件
                //组合出需要shell的完整格式
                string shellArguments = string.Format("x -o+ \"{0}\" \"{1}\\\"",
                    rarfilePath, destPath);
                //用Process调用
                using (Process unrar = new Process())
                {
                    unrar.StartInfo.FileName = @"C:\Program Files\WinRAR\UnRAR.exe";
                    unrar.StartInfo.Arguments = shellArguments;
                    //隐藏rar本身的窗口
                    unrar.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                    unrar.Start();
                    //等待解压完成
                    unrar.WaitForExit();
                    unrar.Close();
                }
            }
            catch (Exception ex)
            {
                return false;
            }
            return true;
        }
bubuko.com,布布扣

 

c# 解压文件,布布扣,bubuko.com

c# 解压文件

原文:http://www.cnblogs.com/pigddyou/p/3714157.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!