我调用下面的函数,程序执行不会报错,问题是没有压缩,谁知道是怎么回事啊?我的平台是VS2003。
protected void Rar()
{
Process pro = new System.Diagnostics.Process();
pro.StartInfo.FileName = @"D:\WinRAR\WinRAR.EXE";
pro.StartInfo.Arguments = @"a D:\Test.rar D:\Test";
pro.Start();
}
protected void Rar()
{
Process pro = new System.Diagnostics.Process();
pro.StartInfo.FileName = @"D:\WinRAR\WinRAR.EXE";
pro.StartInfo.Arguments = @"a D:\Test.rar D:\Test";
pro.Start();
}
确认你的exe路径和带压缩目录的路径都没有问题。
Process pro = new System.Diagnostics.Process();
pro.StartInfo.FileName = @"C:\Program Files\WinRAR\WINRAR.exe";
pro.StartInfo.Arguments = @"a C:\1.rar C:\33";
pro.Start();效果很好啊,加进去了啊@"C:\Program Files\WinRAR\RAR.exe" 也可以你要添加文件的这个压缩包是不是只读了