C#中如何调用makecap.exe来实现对把文件打包成cab格式的,并解压这种文件啊?

解决方案 »

  1.   

    Microsoft Windows XP [版本 5.1.2600]
    (C) 版权所有 1985-2001 Microsoft Corp.makecabMAKECAB [/V[n]] [/D var=value ...] [/L dir] source [destination]
    MAKECAB [/V[n]] [/D var=value ...] /F directive_file [...]  source         File to compress.
      destination    File name to give compressed file.  If omitted, the
                     last character of the source file name is replaced
                     with an underscore (_) and used as the destination.
      /F directives  A file with MakeCAB directives (may be repeated).
      /D var=value   Defines variable with specified value.
      /L dir         Location to place destination (default is current directory).
      /V[n]          Verbosity level (1..3).
      

  2.   

    System.Diagnostics.Process.Start("外部程序名","启动参数");
      

  3.   

    给你个举个例子(源代码) using System;
     
     
     
     class test
     {
     static void Main()
     {
     
     
     
     //声明一个程序信息类
     System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
     
     
     
     //设置外部程序名
     Info.FileName = "notepad.exe";
     
     
     
     //设置外部程序的启动参数(命令行参数)为test.txt
     Info.Arguments = "test.txt";
     
     
     
     //设置外部程序工作目录为 C:\
     Info.WorkingDirectory = "C:\\";
     
     
     
     //声明一个程序类
     System.Diagnostics.Process Proc ;
     
     
     
     try
     {
     //
     //启动外部程序
     //
     Proc = System.Diagnostics.Process.Start(Info);
     }
     catch(System.ComponentModel.Win32Exception e)
     {
     Console.WriteLine("系统找不到指定的程序文件。\r{0}", e);
     return;
     }
     
     
     
     //打印出外部程序的开始执行时间
     Console.WriteLine("外部程序的开始执行时间:{0}", Proc.StartTime);
     
     
     
     //等待3秒钟
     Proc.WaitForExit(3000);
     
     
     
     //如果这个外部程序没有结束运行则对其强行终止
     if(Proc.HasExited == false)
     {
     Console.WriteLine("由主程序强行终止外部程序的运行!");
     Proc.Kill();
     }
     else
     {
     Console.WriteLine("由外部程序正常退出!");
     }
     Console.WriteLine("外部程序的结束运行时间:{0}", Proc.ExitTime);
     Console.WriteLine("外部程序在结束运行时的返回值:{0}", Proc.ExitCode);
     }
     }
      

  4.   

    这个问题很容易,本来不太想回答的,但是为了提高CSDN帖子水平......Process.Start("makecab.exe","/L D:\\ E:\\name.txt");/L 文件夹名  :表示打包保存的目标文件夹最后是源路径查查ProcessStartInfo类,可以实现无运行框模式的。