小菜来袭 2015-07-23 12:02 采纳率: 50%
浏览 1749
已采纳

用c# 写的一个解压文件的程序 解压之后里面的文件不见了 贴上代码~

  string the_rar;
        RegistryKey the_Reg;
        object the_Obj;
        string the_Info;
        try
        {
            the_Reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WinRAR.exe");
            the_Obj = the_Reg.GetValue("");
            the_rar = the_Obj.ToString();
            the_Reg.Close();
            if (Directory.Exists(unRarPatch) == false)
            {
                Directory.CreateDirectory(unRarPatch);
            }

            the_Info = "x " + rarPatch +"\\"+ rarName + " " + unRarPatch + " -y";
            ProcessStartInfo the_StartInfo = new ProcessStartInfo();
            the_StartInfo.FileName = the_rar;
            the_StartInfo.Arguments = the_Info;
            the_StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

            //获取压缩包路径
            the_StartInfo.WorkingDirectory = rarPatch;
            Process the_Process = new Process();
            the_Process.StartInfo = the_StartInfo;
            the_Process.Start();
            the_Process.WaitForExit();
            the_Process.Close();

          new Normal_AdminlogsDAL().SaveMapServiceLog(unRarPatch + " ? " + rarPatch + " ? " + rarName );//Test  
          new Normal_AdminlogsDAL().SaveMapServiceLog(the_Info + " ? " + the_rar);//Test  
        }
        catch (Exception ex)
        {                
            new Normal_AdminlogsDAL().SaveMapServiceLog(" 解压发生异常:" + ex.Message);
        }

  • 写回答

2条回答 默认 最新

  • devmiao 2015-07-23 12:21
    关注

    你这个不是写了一个解压文件,只是简单调用了winrar,你看下你的参数对不对,先在命令行中运行下。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度