public void UnCompressPackage(string PackagePhysicalFullPath)
{
//压缩文件存在的目录
string RARFilePath = Path.GetDirectoryName(PackagePhysicalFullPath);
//解压到文件夹
string UnRARFilePath = Path.Combine(RARFilePath, Path.GetFileNameWithoutExtension(PackagePhysicalFullPath));
Directory.CreateDirectory(UnRARFilePath);
//解压缩
String the_rar;
RegistryKey the_Reg;
Object the_Obj;
String the_Info;
ProcessStartInfo the_StartInfo;
Process the_Process;
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();
the_Info = @" X " + " " + PackagePhysicalFullPath + " " + UnRARFilePath + " -y";
the_StartInfo = new ProcessStartInfo();
the_StartInfo.FileName = the_rar;
the_StartInfo.Arguments = the_Info;
the_StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
the_Process = new Process();
the_Process.StartInfo = the_StartInfo;
the_Process.Start();
the_Process.WaitForExit();
the_Process.Close();
}
命令行调用rar,解压缩文件
最新推荐文章于 2023-02-15 11:13:41 发布