小菜来袭 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条)

报告相同问题?

悬赏问题

  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64
  • ¥15 iOS 自定义输入法-第三方输入法