用的是Process 来做的
英文名的都很快解压出来了
但是只要文件的名称包含中文就会卡在那里
别的程序模块还可以运行
英文名的都很快解压出来了
但是只要文件的名称包含中文就会卡在那里
别的程序模块还可以运行
解决方案 »
- 页面上有个<select></select>用js或jq或后台写个循环生成一个连续的年份如2000-2012然后添加到select下拉框,value值对应年份
- 急Microsoft JScript 运行时错误: Sys.WebForms.PageRequestManagerParserErrorException
- 关于Aflax
- CheckBool问题,小菜请教
- ASP.Net网页转移(移植) 问题! 在线,急…………
- 【不在同一个画面上,怎么进行函数调用.而且有返回直.原理是什么.我想听听大家的意见.】
- 用户手动刷新页面时 当前焦点自动PostBack 怒...
- 我在onmouseover中加的javascript语句,为何只有alert('...')能够执行!
- 如何在c#中用老版的ado访问数据库并能得到老版的数据集?
- 今天学习遇到两个小问题?谢谢解答
- 关于方向按键的问题
- 请问用什么方法可知道gridview的一行或多行被修改
{
/// <summary>
/// 是否安装了Winrar
/// </summary>
/// <returns></returns>
static public bool Exists()
{
RegistryKey the_Reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WinRAR.exe");
return !string.IsNullOrEmpty(the_Reg.GetValue("").ToString());
}
/// <summary>
/// 打包成Rar
/// </summary>
/// <param name="patch"></param>
/// <param name="rarPatch"></param>
/// <param name="rarName"></param>
public void CompressRAR(string patch, string rarPatch, string rarName)
{
string the_rar;
RegistryKey the_Reg;
object the_Obj;
string the_Info;
ProcessStartInfo the_StartInfo;
Process the_Process;
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();
the_rar = the_rar.Substring(1, the_rar.Length - 7);
Directory.CreateDirectory(patch);
//命令参数
//the_Info = " a " + rarName + " " + @"C:Test?70821.txt"; //文件压缩
the_Info = " a " + rarName + " " + patch + " -r"; ;
the_StartInfo = new ProcessStartInfo();
the_StartInfo.FileName = the_rar;
the_StartInfo.Arguments = the_Info;
the_StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
//打包文件存放目录
the_StartInfo.WorkingDirectory = rarPatch;
the_Process = new Process();
the_Process.StartInfo = the_StartInfo;
the_Process.Start();
the_Process.WaitForExit();
the_Process.Close();
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 解压
/// </summary>
/// <param name="unRarPatch"></param>
/// <param name="rarPatch"></param>
/// <param name="rarName"></param>
/// <returns></returns>
public string unCompressRAR(string unRarPatch, string rarPatch, string rarName)
{
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();
//the_rar = the_rar.Substring(1, the_rar.Length - 7); if (Directory.Exists(unRarPatch) == false)
{
Directory.CreateDirectory(unRarPatch);
}
the_Info = "x " + 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();
}
catch (Exception ex)
{
throw ex;
}
return unRarPatch;
} }