显示列表

private void RAR()
{
    // 把WinRAR目录复制到网站目录下。
    string pathRoot = Server.MapPath("/");
    string winRAR = pathRoot + "WinRAR/WinRAR.exe";

    // 把Job.aspx和Default.aspx这两个文件添加到压缩包Job.rar中
    string arguments = @"a Job.rar Job.aspx Default.aspx";
    
    try
    {
        ProcessStartInfo info = new ProcessStartInfo();
        info.FileName = winRAR; // WinRaR.exe目录
        info.Arguments = arguments; // 参数
        info.WorkingDirectory = pathRoot;

        Process p = new Process();
        p.StartInfo = info;
        p.Start();//启动

        Response.Write("压缩成功。");
    }
    catch (Exception ex)
    {
        Response.Write(ex.Message);
    }
}

标签:rar 
返回摘要 | 分类(Asp.Net) | 访问(37) | 编辑