RT,谢谢

解决方案 »

  1.   

            string filePath=@"D:\\test.txt";
            System.Diagnostics.Process process = new System.Diagnostics.Process();
            process.StartInfo.FileName = "Winrar.exe";
            process.StartInfo.CreateNoWindow = true;
            process.StartInfo.Arguments = string.format("{0} {1}"," a -ep ,filePath);
      

  2.   

    winrar有命令行调用模式,你直接查找命令行的命令格式,然后使用Process调用即可
      

  3.   

              process.StartInfo.Arguments = string.format("{0} {1}"," a -ep ,filePath);不明白...呵呵
      

  4.   

    额,我明白, process.StartInfo.Arguments = string.format("{0} {1}"," a -ep ,filePath); 
    就是写Winrar的运行参数的,前面不知道在Winrar里面什么意思,请按照3楼的找找,第二项就是文件所在目录了,2楼给的演示是压缩那个TXT文件的!!!具体没有试过!
      

  5.   

    用下面几行代码压缩文件有问题,请帮忙看下,谢谢  private void button1_Click(object sender, EventArgs e)
            {
                string filePath=@"E:\\aaa.txt";
                string rarPath = @"E:\\aaa.rar";
                System.Diagnostics.Process process1 = new System.Diagnostics.Process(); 
                process1.StartInfo.FileName = "Winrar.exe"; 
                process1.StartInfo.CreateNoWindow = true;            // process.StartInfo.Arguments = string.Format("{0} {1}", "a -ep", filePath);           //加密要所文件
               process1.StartInfo.Arguments = "a -p123456" + rarPath + " " + filePath;            //解压缩文件
                process1.StartInfo.Arguments = "x -p123456" + rarPath + " " + filePath;
                process1.Start();
                process1.WaitForExit();            
            }
      

  6.   

    "a -p123456" + rarPath之间是不是少了空格?
      

  7.   

          string filePath=@"E:\\aaa.txt";
                string rarPath = @"E:\\aaa.rar";
            System.Diagnostics.Process process1 = new System.Diagnostics.Process(); 
            process1.StartInfo.FileName = "Winrar.exe"; 
            process1.StartInfo.CreateNoWindow = true;        //加密压缩文件
            process1.StartInfo.Arguments = "-a -p123456" + rarPath + " " + filePath;
            process1.Start();
    //*************************
    E:\\aaa.txt
    这个压缩文件格式未知或者数据已经被损坏
      

  8.   

    string filePath="E:\\aaa.txt"; 
    string rarPath = "E:\\aaa.rar"; 或者
    string filePath=@"E:\aaa.txt"; 
    string rarPath = @"E:\aaa.rar"; 
    再试试。
      

  9.   

      string filePath=@"E:\aaa.txt";
                string rarPath = @"E:\aaa.rar";
            System.Diagnostics.Process process1 = new System.Diagnostics.Process(); 
            process1.StartInfo.FileName = "Winrar.exe"; 
            process1.StartInfo.CreateNoWindow = true;        //加密压缩文件
            process1.StartInfo.Arguments = " a -p123456 " + rarPath + " " + filePath;
            process1.Start();
    可以啦...谢谢
      

  10.   

    用进程process控制参数来使用winrar.使用方法就是2,3楼所说的
    winrar命令