Asp.net调用RAR压缩 解压文件
//压缩
 protected void btnY_Click(object sender, EventArgs e)
    protected void btnY_Click(object sender, EventArgs e)
 {
    {
 string rar;
        string rar;
 RegistryKey reg;
        RegistryKey reg;
 string args;
        string args;
 ProcessStartInfo procStart;
        ProcessStartInfo procStart;
 Process process;
        Process process;
 try
        try
 {
        {
 reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRAR.exe\Shell\Open\Command");
            reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRAR.exe\Shell\Open\Command");
 rar = reg.GetValue("").ToString();//获取注册表rar安装路径
            rar = reg.GetValue("").ToString();//获取注册表rar安装路径
 reg.Close();
            reg.Close();
 rar = rar.Substring(1, rar.Length - 7);//获取rar安装路径
            rar = rar.Substring(1, rar.Length - 7);//获取rar安装路径
 args = "a -inul -y G:\\temp.rar G:\\1.txt";//这里为rar的压缩命令格式(也可以自行扩展)
            args = "a -inul -y G:\\temp.rar G:\\1.txt";//这里为rar的压缩命令格式(也可以自行扩展)
 procStart = new ProcessStartInfo();
            procStart = new ProcessStartInfo();
 procStart.FileName = rar;
            procStart.FileName = rar;
 procStart.Arguments = args;//参数
            procStart.Arguments = args;//参数
 procStart.WindowStyle = ProcessWindowStyle.Hidden;//窗口状态
            procStart.WindowStyle = ProcessWindowStyle.Hidden;//窗口状态
 procStart.WorkingDirectory = Server.MapPath(""); ;//获取或设置要启动的进程的初始目录。
            procStart.WorkingDirectory = Server.MapPath(""); ;//获取或设置要启动的进程的初始目录。
 process = new Process();
            process = new Process();
 process.StartInfo = procStart;
            process.StartInfo = procStart;
 process.Start();
            process.Start();
 Response.Write("<script>alert('压缩成功')</script>");
            Response.Write("<script>alert('压缩成功')</script>");
 }
        }
 catch (Exception ex)
        catch (Exception ex)
 {
        {
 Response.Write(ex.ToString());
            Response.Write(ex.ToString());
 }
        }
 }
    }
 //解压
    //解压
 protected void btnJ_Click(object sender, EventArgs e)
    protected void btnJ_Click(object sender, EventArgs e)
 {
    {
 string rar;
        string rar;
 RegistryKey reg;
        RegistryKey reg;
 string args;
        string args;
 ProcessStartInfo startInfo;
        ProcessStartInfo startInfo;
 Process process;
        Process process;
 try
        try
 {
        {
 reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRar.exe\Shell\Open\Command");
            reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRar.exe\Shell\Open\Command");
 rar = reg.GetValue("").ToString();
            rar = reg.GetValue("").ToString();
 reg.Close();
            reg.Close();
 rar = rar.Substring(1, rar.Length - 7);
            rar = rar.Substring(1, rar.Length - 7);
 args = " X E:\\temp.rar E:\\";
            args = " X E:\\temp.rar E:\\";
 startInfo = new ProcessStartInfo();
            startInfo = new ProcessStartInfo();
 startInfo.FileName = rar;
            startInfo.FileName = rar;
 startInfo.Arguments = args;
            startInfo.Arguments = args;
 startInfo.WindowStyle = ProcessWindowStyle.Hidden;
            startInfo.WindowStyle = ProcessWindowStyle.Hidden;
 process = new Process();
            process = new Process();
 process.StartInfo = startInfo;
            process.StartInfo = startInfo;
 process.Start();
            process.Start();
 Response.Write("<script>alert('解压成功')</script>");
            Response.Write("<script>alert('解压成功')</script>");
 }
        }
 catch (Exception ex)
        catch (Exception ex)
 {
        {
 Response.Write(ex.ToString());
            Response.Write(ex.ToString());
 }
        }
 }
    }
 protected void btnY_Click(object sender, EventArgs e)
    protected void btnY_Click(object sender, EventArgs e) {
    { string rar;
        string rar; RegistryKey reg;
        RegistryKey reg; string args;
        string args; ProcessStartInfo procStart;
        ProcessStartInfo procStart; Process process;
        Process process; try
        try {
        { reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRAR.exe\Shell\Open\Command");
            reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRAR.exe\Shell\Open\Command"); rar = reg.GetValue("").ToString();//获取注册表rar安装路径
            rar = reg.GetValue("").ToString();//获取注册表rar安装路径 reg.Close();
            reg.Close(); rar = rar.Substring(1, rar.Length - 7);//获取rar安装路径
            rar = rar.Substring(1, rar.Length - 7);//获取rar安装路径 args = "a -inul -y G:\\temp.rar G:\\1.txt";//这里为rar的压缩命令格式(也可以自行扩展)
            args = "a -inul -y G:\\temp.rar G:\\1.txt";//这里为rar的压缩命令格式(也可以自行扩展) procStart = new ProcessStartInfo();
            procStart = new ProcessStartInfo(); procStart.FileName = rar;
            procStart.FileName = rar; procStart.Arguments = args;//参数
            procStart.Arguments = args;//参数 procStart.WindowStyle = ProcessWindowStyle.Hidden;//窗口状态
            procStart.WindowStyle = ProcessWindowStyle.Hidden;//窗口状态 procStart.WorkingDirectory = Server.MapPath(""); ;//获取或设置要启动的进程的初始目录。
            procStart.WorkingDirectory = Server.MapPath(""); ;//获取或设置要启动的进程的初始目录。 process = new Process();
            process = new Process(); process.StartInfo = procStart;
            process.StartInfo = procStart; process.Start();
            process.Start(); Response.Write("<script>alert('压缩成功')</script>");
            Response.Write("<script>alert('压缩成功')</script>"); }
        } catch (Exception ex)
        catch (Exception ex) {
        { Response.Write(ex.ToString());
            Response.Write(ex.ToString()); }
        } }
    } //解压
    //解压 protected void btnJ_Click(object sender, EventArgs e)
    protected void btnJ_Click(object sender, EventArgs e) {
    { string rar;
        string rar; RegistryKey reg;
        RegistryKey reg; string args;
        string args; ProcessStartInfo startInfo;
        ProcessStartInfo startInfo; Process process;
        Process process; try
        try {
        { reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRar.exe\Shell\Open\Command");
            reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRar.exe\Shell\Open\Command"); rar = reg.GetValue("").ToString();
            rar = reg.GetValue("").ToString(); reg.Close();
            reg.Close(); rar = rar.Substring(1, rar.Length - 7);
            rar = rar.Substring(1, rar.Length - 7); args = " X E:\\temp.rar E:\\";
            args = " X E:\\temp.rar E:\\"; startInfo = new ProcessStartInfo();
            startInfo = new ProcessStartInfo(); startInfo.FileName = rar;
            startInfo.FileName = rar; startInfo.Arguments = args;
            startInfo.Arguments = args; startInfo.WindowStyle = ProcessWindowStyle.Hidden;
            startInfo.WindowStyle = ProcessWindowStyle.Hidden; process = new Process();
            process = new Process(); process.StartInfo = startInfo;
            process.StartInfo = startInfo; process.Start();
            process.Start(); Response.Write("<script>alert('解压成功')</script>");
            Response.Write("<script>alert('解压成功')</script>"); }
        } catch (Exception ex)
        catch (Exception ex) {
        { Response.Write(ex.ToString());
            Response.Write(ex.ToString()); }
        } }
    }
    玉环人才吧
玉环人才网
玉环人力网
玉环招聘网
三支脚人才网
玉环人力网(又名玉环人才网)是玉环人才吧旗下一流的玉环人力资源招聘行业服务品牌,汇集海量玉环人才,开放玉环人才简历和玉环岗位,提供玉环招聘网,玉环人才市场动态行情,玉环劳务派遣,玉环培训等,是玉环最大的人才网站。
 
                    
                     
                    
                 
                    
                 
                
            
         
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号