给我在银行的同学写了好几个文本文件的数据提取小程序,其中,源文件都是.zip压缩文件。将这个东东放上来大家参阅一下。 public class RarFile { public static bool UnCompress(string fileName, string destinationPath) { if (!System.IO.File.Exists(fileName)) { // MessageBox.Show("没有找到压缩文件" + fileName,"错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return false; } //声明一个程序信息类 System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo("winrar.exe"); //设置外部程序的启动参数(命令行参数) Info.Arguments = " e " + fileName + " " +destinationPath; // 隐藏外部程序 Info.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; //声明一个程序类 System.Diagnostics.Process Proc ; try { //启动外部程序 Proc = System.Diagnostics.Process.Start(Info); } catch(System.ComponentModel.Win32Exception) { MessageBox.Show("系统找不到WinRar的程序文件!\n请先安装WinRar程序。", "错误",MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } //无限期地等待关联进程退出 Proc.WaitForExit(); return true; } } 相关文章: 2022-12-23 2021-06-03 2021-09-28 2021-06-19 2021-10-30 2021-06-06 2021-11-30